smengcl commented on a change in pull request #2472:
URL: https://github.com/apache/hadoop/pull/2472#discussion_r526536143



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsAdmin.java
##########
@@ -171,7 +174,15 @@ public void clearQuotaByStorageType(Path src, StorageType 
type) throws IOExcepti
   public void allowSnapshot(Path path) throws IOException {
     dfs.allowSnapshot(path);
     if (dfs.isSnapshotTrashRootEnabled()) {
-      dfs.provisionSnapshotTrash(path, TRASH_PERMISSION);
+      try {
+        dfs.provisionSnapshotTrash(path, TRASH_PERMISSION);
+      } catch (FileAlreadyExistsException ex) {
+        // Don't throw on FileAlreadyExistsException since it is likely due to
+        // admin allowing snapshot on an EZ root.
+        LOG.warn(ex.getMessage());

Review comment:
       Thanks @bshashikant for the comment.
   
   I was intending to not change the behavior of `DFS#provisionSnapshotTrash` 
but as I think again changing it should be fine since 3.4.0 is not released yet.
   
   I'm in favor of (1). It makes sense to reuse the trash if it is configured 
correctly. I will update the PR a bit later.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to