openinx commented on a change in pull request #336: HBASE-22580 Add a table 
attribute to make user scan snapshot feature configurable for table
URL: https://github.com/apache/hbase/pull/336#discussion_r298160417
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SnapshotScannerHDFSAclController.java
 ##########
 @@ -263,14 +264,32 @@ public void 
postDeleteTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
     }
   }
 
+  @Override
+  public void postModifyTable(ObserverContext<MasterCoprocessorEnvironment> 
ctx,
+      TableName tableName, TableDescriptor oldDescriptor, TableDescriptor 
currentDescriptor)
+      throws IOException {
+    if (needSetTableHdfsAcl(currentDescriptor, () -> "modifyTable " + 
tableName)
+        && !hdfsAclHelper.isTableUserScanSnapshotEnabled(oldDescriptor)) {
+      hdfsAclHelper.createTableDirectories(tableName);
+      Set<String> tableUsers = 
hdfsAclHelper.getUsersWithTableReadAction(tableName, false, false);
+      Set<String> users =
+          
hdfsAclHelper.getUsersWithNamespaceReadAction(tableName.getNamespaceAsString(), 
true);
+      users.addAll(tableUsers);
+      hdfsAclHelper.addTableAcl(tableName, users);
+      
SnapshotScannerHDFSAclStorage.addUserTableHdfsAcl(ctx.getEnvironment().getConnection(),
+        tableUsers, tableName);
+    } else if (!aclTableInitialized
+        && Bytes.equals(PermissionStorage.ACL_GLOBAL_NAME, 
tableName.getName())) {
+      aclTableInitialized = true;
 
 Review comment:
   Oh, you update the aclTableInitialized here  when add HDFS_ACL_FAMILY in 
hbase:acl ?  Why just update the flag once the modifyTable called successfully 
?  I think that will be easy to understand.

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