hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tasan...@apache.org
Subject [hadoop] branch trunk updated: HDFS-15090. RBF: MountPoint Listing Should Return Flag Values Of Destination. Contributed by Ayush Saxena.
Date Mon, 06 Jan 2020 09:11:24 GMT
This is an automated email from the ASF dual-hosted git repository.

tasanuma pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 4a76ab7  HDFS-15090. RBF: MountPoint Listing Should Return Flag Values Of Destination.
Contributed by Ayush Saxena.
4a76ab7 is described below

commit 4a76ab777fdd2b72c438c73d45ffbe2f6bb8bb0d
Author: Takanobu Asanuma <tasanuma@apache.org>
AuthorDate: Mon Jan 6 18:09:59 2020 +0900

    HDFS-15090. RBF: MountPoint Listing Should Return Flag Values Of Destination. Contributed
by Ayush Saxena.
---
 .../federation/router/RouterClientProtocol.java       |  6 ++++++
 .../federation/router/TestRouterMountTable.java       | 19 ++++++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java
b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java
index b7c2b03..5798380 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java
@@ -1921,6 +1921,8 @@ public class RouterClientProtocol implements ClientProtocol {
     FsPermission permission = FsPermission.getDirDefault();
     String owner = this.superUser;
     String group = this.superGroup;
+    EnumSet<HdfsFileStatus.Flags> flags =
+        EnumSet.noneOf(HdfsFileStatus.Flags.class);
     if (subclusterResolver instanceof MountTableResolver) {
       try {
         String mName = name.startsWith("/") ? name : "/" + name;
@@ -1940,6 +1942,9 @@ public class RouterClientProtocol implements ClientProtocol {
             owner = fInfo.getOwner();
             group = fInfo.getGroup();
             childrenNum = fInfo.getChildrenNum();
+            flags = DFSUtil
+                .getFlags(fInfo.isEncrypted(), fInfo.isErasureCoded(),
+                    fInfo.isSnapshotEnabled(), fInfo.hasAcl());
           }
         }
       } catch (IOException e) {
@@ -1971,6 +1976,7 @@ public class RouterClientProtocol implements ClientProtocol {
         .path(DFSUtil.string2Bytes(name))
         .fileId(inodeId)
         .children(childrenNum)
+        .flags(flags)
         .build();
   }
 
diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTable.java
b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTable.java
index 572b33d..77ec47a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTable.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTable.java
@@ -37,6 +37,7 @@ import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.hdfs.DistributedFileSystem;
 import org.apache.hadoop.hdfs.protocol.ClientProtocol;
 import org.apache.hadoop.hdfs.protocol.DirectoryListing;
 import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
@@ -663,4 +664,20 @@ public class TestRouterMountTable {
       nnFs0.delete(new Path("/testrename2"), true);
     }
   }
-}
\ No newline at end of file
+
+  @Test
+  public void testListStatusMountPoint() throws Exception {
+    try {
+      MountTable addEntry = MountTable.newInstance("/mount/testLsMountEntry",
+          Collections.singletonMap("ns0", "/testLsMountEntryDest"));
+      assertTrue(addMountTable(addEntry));
+      nnFs0.mkdirs(new Path("/testLsMountEntryDest"));
+      DistributedFileSystem routerDfs = (DistributedFileSystem) routerFs;
+      Path mountPath = new Path("/mount/testLsMountEntry");
+      routerDfs.setErasureCodingPolicy(mountPath, "RS-6-3-1024k");
+      assertTrue(routerDfs.listStatus(new Path("/mount"))[0].isErasureCoded());
+    } finally {
+      nnFs0.delete(new Path("/testLsMountEntryDest"), true);
+    }
+  }
+}


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