hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject [13/21] hadoop git commit: putNew() should create parent CachedDirectory state
Date Fri, 08 Jul 2016 21:30:20 GMT
putNew() should create parent CachedDirectory state

.. even if parent dir is not currently cached. Subsequent
calls to listStatus(parent) need to at least return a
CachedDirectory with the new file and fullyCached = false.
This allows clients to detect backend inconsistency in the
list-after-put case.


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

Branch: refs/heads/s3_create
Commit: b06338099eedde8b9b758930a0ed9aa535c479fb
Parents: e0c1fee
Author: Aaron Fabbri <fabbri@cloudera.com>
Authored: Tue Jul 5 17:11:38 2016 -0700
Committer: Aaron Fabbri <fabbri@cloudera.com>
Committed: Tue Jul 5 17:19:14 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/fs/s3a/LocalMetadataStore.java | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b0633809/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 d5db39b..e6d5153 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
@@ -1,6 +1,7 @@
 package org.apache.hadoop.fs.s3a;
 
 import com.google.common.annotations.VisibleForTesting;
+import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.Path;
 
 import javax.annotation.Nullable;
@@ -101,12 +102,16 @@ public class LocalMetadataStore implements MetadataStore {
         dirHash.put(f, dir);
       }
 
-      /* Update cached parent dir, if any. */
-      // XXX TODO handle root directory
-      CachedDirectory parent = dirHash.get(f.getParent());
-      if (parent != null) {
-        parent.addFile(cfs.fileStatus);
+      /* Update cached parent dir. */
+      Path parentPath = f.getParent();
+      CachedDirectory parent = dirHash.get(parentPath);
+      if (parent == null) {
+        /* Track this new file's listing in parent.  Parent is not fullyCached,
+           since there may be other items in it we don't know about. */
+        parent = new CachedDirectory(parentPath, new FileStatus[0], false);
+        dirHash.put(parentPath, parent);
       }
+      parent.addFile(cfs.fileStatus);
     }
   }
 


---------------------------------------------------------------------
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