hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject [11/21] hadoop git commit: Rename clearHashByPrefix() to clearHashByAncestor()
Date Fri, 08 Jul 2016 21:30:18 GMT
Rename clearHashByPrefix() to clearHashByAncestor()

This is a more accurate name.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a354674f
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a354674f
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a354674f

Branch: refs/heads/s3_create
Commit: a354674f1b5e86841884e91d2b8ffd1a500919b7
Parents: f39f5b3
Author: Aaron Fabbri <fabbri@cloudera.com>
Authored: Thu Jun 30 16:31:51 2016 -0700
Committer: Aaron Fabbri <fabbri@cloudera.com>
Committed: Thu Jun 30 16:31:51 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/fs/s3a/LocalMetadataStore.java    | 8 ++++----
 .../org/apache/hadoop/fs/s3a/TestLocalMetadataStore.java     | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/a354674f/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/LocalMetadataStore.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/LocalMetadataStore.java
b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/LocalMetadataStore.java
index 6fc4571..a66f619 100644
--- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/LocalMetadataStore.java
+++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/LocalMetadataStore.java
@@ -62,8 +62,8 @@ public class LocalMetadataStore implements MetadataStore {
 
       if (recursive && cfs.getFileStatus().isDirectory()) {
         // Remove all entries that have this dir as path prefix.
-        clearHashByPrefix(f, dirHash);
-        clearHashByPrefix(f, fileHash);
+        clearHashByAncestor(f, dirHash);
+        clearHashByAncestor(f, fileHash);
       }
       return true;
     }
@@ -133,13 +133,13 @@ public class LocalMetadataStore implements MetadataStore {
   }
 
   @VisibleForTesting
-  static <T> void clearHashByPrefix(Path prefix, Map<Path,T> hash) {
+  static <T> void clearHashByAncestor(Path ancestor, Map<Path,T> hash) {
     for (Iterator<Map.Entry<Path,T>> it = hash.entrySet().iterator();
          it.hasNext(); )
     {
       Map.Entry<Path,T> entry = it.next();
       Path f = entry.getKey();
-      if (isAncestorOf(prefix, f)) {
+      if (isAncestorOf(ancestor, f)) {
         it.remove();
       }
     }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/a354674f/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestLocalMetadataStore.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestLocalMetadataStore.java
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestLocalMetadataStore.java
index f30166d..4af60ea 100644
--- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestLocalMetadataStore.java
+++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestLocalMetadataStore.java
@@ -182,13 +182,13 @@ public class TestLocalMetadataStore extends Assert {
     for (String pathStr : paths) {
       testMap.put(new Path(pathStr), "blah");
     }
-    LocalMetadataStore.clearHashByPrefix(new Path("/a1/b1"), testMap);
+    LocalMetadataStore.clearHashByAncestor(new Path("/a1/b1"), testMap);
     assertEquals("Two were deleted", paths.size()-2, testMap.size());
     assertNull("c1 deleted", testMap.get("/a1/b1/c1"));
     assertNull("e1 deleted", testMap.get("/a1/b1/c1/d1/e1"));
 
     /* Make sure false prefix match doesn't work. */
-    LocalMetadataStore.clearHashByPrefix(new Path("/a"), testMap);
+    LocalMetadataStore.clearHashByAncestor(new Path("/a"), testMap);
     assertEquals("Partial prefix dir doesn't match", paths.size()-2,
       testMap.size());
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message