hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mackror...@apache.org
Subject [2/6] hadoop git commit: Reproduced erroneous authoritative listing
Date Thu, 25 May 2017 12:13:14 GMT
Reproduced erroneous authoritative listing


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

Branch: refs/heads/HADOOP-13345
Commit: 83b82348ff8a4bd347b5c868ebdd87df3961a5a0
Parents: 2f3305d
Author: Sean Mackrory <mackrorysd@apache.org>
Authored: Wed May 24 09:19:01 2017 -0600
Committer: Sean Mackrory <mackrorysd@apache.org>
Committed: Wed May 24 17:19:39 2017 -0600

----------------------------------------------------------------------
 .../org/apache/hadoop/fs/s3a/S3AFileSystem.java |  2 +-
 .../fs/contract/s3a/ITestS3AContractRename.java | 47 ++++++++++++++++++++
 .../fs/s3a/s3guard/TestLocalMetadataStore.java  |  2 +-
 3 files changed, 49 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/83b82348/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java
b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java
index 7de94cc..ffb2147 100644
--- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java
+++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java
@@ -960,7 +960,7 @@ public class S3AFileSystem extends FileSystem {
   }
 
   @VisibleForTesting
-  MetadataStore getMetadataStore() {
+  public MetadataStore getMetadataStore() {
     return metadataStore;
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/83b82348/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractRename.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractRename.java
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractRename.java
index 4339649..65da13a 100644
--- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractRename.java
+++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractRename.java
@@ -23,6 +23,14 @@ import org.apache.hadoop.fs.contract.AbstractContractRenameTest;
 import org.apache.hadoop.fs.contract.AbstractFSContract;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.s3a.S3AFileSystem;
+import org.apache.hadoop.fs.s3a.Tristate;
+import org.apache.hadoop.fs.s3a.s3guard.DirListingMetadata;
+import org.apache.hadoop.fs.s3a.s3guard.MetadataStore;
+import org.apache.hadoop.fs.s3a.s3guard.S3Guard;
+import org.junit.Test;
+
+import java.io.IOException;
 
 import static org.apache.hadoop.fs.contract.ContractTestUtils.dataset;
 import static org.apache.hadoop.fs.contract.ContractTestUtils.writeDataset;
@@ -72,4 +80,43 @@ public class ITestS3AContractRename extends AbstractContractRenameTest
{
     boolean rename = fs.rename(srcDir, destDir);
     assertFalse("s3a doesn't support rename to non-empty directory", rename);
   }
+
+  @Override
+  @Test
+  public void testRenamePopulatesFileAncestors() throws IOException {
+    final FileSystem fs = getFileSystem();
+    final Path src = path("testRenamePopulatesFileAncestors/source");
+    fs.mkdirs(src);
+    final String nestedFile = "/dir1/dir2/dir3/file4";
+    byte[] srcDataset = dataset(256, 'a', 'z');
+    writeDataset(fs, path(src + nestedFile), srcDataset, srcDataset.length,
+        1024, false);
+
+    Path dst = path("testRenamePopulatesFileAncestorsNew");
+
+    DirListingMetadata l = ((S3AFileSystem)fs).getMetadataStore()
+        .listChildren(src);
+    fs.rename(src, dst);
+  }
+
+  @Test
+  public void testMkdirPopulatesFileAncestors() throws IOException {
+    final FileSystem fs = getFileSystem();
+    final MetadataStore ms = ((S3AFileSystem) fs).getMetadataStore();
+    final Path parent = path("testMkdirPopulatesFileAncestors/source");
+    try {
+      //fs.mkdirs(parent);
+      final Path nestedFile = new Path(parent, "/dir1/dir2/dir3/file4");
+      byte[] srcDataset = dataset(256, 'a', 'z');
+      writeDataset(fs, nestedFile, srcDataset, srcDataset.length,
+          1024, false);
+
+      DirListingMetadata list = ms.listChildren(parent);
+      System.out.println("list isEmpty: " + list.isEmpty());
+      System.out.println("list isAuthoritative: " + list.isAuthoritative());
+      assertTrue(list.isEmpty() == Tristate.FALSE || !list.isAuthoritative());
+    } finally {
+      fs.delete(parent, true);
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/83b82348/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/TestLocalMetadataStore.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/TestLocalMetadataStore.java
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/TestLocalMetadataStore.java
index 89d0498..81183e70 100644
--- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/TestLocalMetadataStore.java
+++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/TestLocalMetadataStore.java
@@ -24,6 +24,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.s3a.S3ATestUtils;
 
+import org.apache.hadoop.fs.s3a.Tristate;
 import org.junit.Test;
 
 import java.io.IOException;
@@ -136,5 +137,4 @@ public class TestLocalMetadataStore extends MetadataStoreTestBase {
     S3ATestUtils.verifyDirStatus(status, REPLICATION, getModTime(),
         getAccessTime(), OWNER, GROUP, PERMISSION);
   }
-
 }


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