openinx commented on a change in pull request #485: HBASE-22842 Tmp directory 
should not be deleted when master restart used for user scan snapshot feature
URL: https://github.com/apache/hbase/pull/485#discussion_r313293005
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
 ##########
 @@ -319,19 +320,22 @@ void checkTempDir(final Path tmpdir, final Configuration 
c, final FileSystem fs)
         HFileArchiver.archiveRegions(c, fs, this.rootdir, tableDir,
           FSUtils.getRegionDirs(fs, tableDir));
       }
-      if (!fs.delete(tmpdir, true)) {
+      // if acl sync to hdfs is enabled, then skip delete tmp dir because ACLs 
are set
+      if (!SnapshotScannerHDFSAclHelper.isAclSyncToHdfsEnabled(c) && 
!fs.delete(tmpdir, true)) {
         throw new IOException("Unable to clean the temp directory: " + tmpdir);
       }
     }
 
     // Create the temp directory
-    if (isSecurityEnabled) {
-      if (!fs.mkdirs(tmpdir, secureRootSubDirPerms)) {
-        throw new IOException("HBase temp directory '" + tmpdir + "' creation 
failure.");
-      }
-    } else {
-      if (!fs.mkdirs(tmpdir)) {
-        throw new IOException("HBase temp directory '" + tmpdir + "' creation 
failure.");
+    if (!fs.exists(tmpdir)) {
+      if (isSecurityEnabled) {
 
 Review comment:
   ```
   if(isSecurityEnabled & !fs.mkdirs(tmpdir, secureRootSubDirPerms)){
     // ... 
   }else if(!fs.mkdirs(tmpdir){
     // ...
   }
   ```
    nit: Can make it shorter ? 

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


With regards,
Apache Git Services

Reply via email to