hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [hadoop] szetszwo commented on a change in pull request #2352: HDFS-15607. Create trash dir when allowing snapshottable dir
Date Thu, 01 Oct 2020 00:37:56 GMT

szetszwo commented on a change in pull request #2352:
URL: https://github.com/apache/hadoop/pull/2352#discussion_r497882623



##########
File path: hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
##########
@@ -2901,6 +2945,74 @@ private void provisionEZTrash(String path, FsPermission trashPermission)
     setPermission(trashPath, trashPermission);
   }
 
+  /**
+   * HDFS only.
+   * 
+   * Provision snapshottable directory trash.
+   * @param path Path to a snapshottable directory.
+   * @param trashPermission Expected FsPermission of the trash root.
+   * @throws IOException
+   */
+  public void provisionSnapshottableDirTrash(final Path path,
+      final FsPermission trashPermission) throws IOException {
+    Path absF = fixRelativePart(path);
+    new FileSystemLinkResolver<Void>() {
+      @Override
+      public Void doCall(Path p) throws IOException {
+        provisionSnapshottableDirTrash(getPathName(p), trashPermission);
+        return null;
+      }
+
+      @Override
+      public Void next(FileSystem fs, Path p) throws IOException {
+        if (fs instanceof DistributedFileSystem) {
+          DistributedFileSystem myDfs = (DistributedFileSystem)fs;
+          myDfs.provisionSnapshottableDirTrash(p, trashPermission);
+          return null;
+        }
+        throw new UnsupportedOperationException(
+            "Cannot provisionSnapshottableDirTrash through a symlink to" +
+            " a non-DistributedFileSystem: " + fs + " -> " + p);
+      }
+    }.resolve(this, absF);
+  }
+
+  private void provisionSnapshottableDirTrash(
+      String pathStr, FsPermission trashPermission) throws IOException {
+    Path path = new Path(pathStr);

Review comment:
       Sure, adding a warning sounds good.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


Mime
View raw message