virajjasani commented on code in PR #5437:
URL: https://github.com/apache/hbase/pull/5437#discussion_r1339143039


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java:
##########
@@ -573,6 +576,36 @@ public synchronized void 
prepareWorkingDirectory(SnapshotDescription snapshot)
     }
   }
 
+  /**
+   * If the parent dir of the snapshot working dir (e.g. 
/hbase/.hbase-snapshot) has non-empty ACLs,
+   * use them for the current working dir (e.g. 
/hbase/.hbase-snapshot/.tmp/{snapshot-name}) so that
+   * regardless of whether the snapshot commit phase performs atomic rename or 
non-atomic copy of
+   * the working dir to new snapshot dir, the ACLs are retained.
+   * @param workingDir   working dir to build the snapshot.
+   * @param workingDirFS working dir file system.
+   * @throws IOException If ACL read/modify operation fails.
+   */
+  private static void updateWorkingDirAclsIfRequired(Path workingDir, 
FileSystem workingDirFS)
+    throws IOException {
+    AclStatus snapshotWorkingParentDirStatus;
+    try {
+      snapshotWorkingParentDirStatus =
+        workingDirFS.getAclStatus(workingDir.getParent().getParent());

Review Comment:
   looks like it can be configured to be different, and in that case even 
original ACLs would not be applicable so better to have null check and return 
in such cases:
   
   ```
     /**
      * Get the general working directory for snapshots - where they are built, 
where they are
      * temporarily copied on export, etc.
      * @param rootDir root directory of the HBase installation
      * @param conf    Configuration of the HBase instance
      * @return Path to the snapshot tmp directory, relative to the passed root 
directory
      */
     public static Path getWorkingSnapshotDir(final Path rootDir, final 
Configuration conf) {
       return new Path(
         conf.get(SNAPSHOT_WORKING_DIR, 
getDefaultWorkingSnapshotDir(rootDir).toString()));
     }
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to