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_r297130175
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SnapshotScannerHDFSAclController.java
##########
@@ -263,10 +265,36 @@ public void
postDeleteTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
}
}
+ @Override
+ public void postModifyTable(ObserverContext<MasterCoprocessorEnvironment>
ctx,
+ TableName tableName, TableDescriptor oldDescriptor, TableDescriptor
currentDescriptor)
+ throws IOException {
+ if (checkTable(currentDescriptor, () -> "modifyTable " + tableName)
+ && !hdfsAclHelper.isTableUserScanSnapshotEnabled(oldDescriptor)) {
+ hdfsAclHelper.createTableDirectories(tableName);
+ Set<String> users = new HashSet<>();
+ users.addAll(hdfsAclHelper.getUsersWithGlobalReadAction());
+
users.addAll(hdfsAclHelper.getUsersWithNamespaceReadAction(tableName.getNamespaceAsString()));
+ Set<String> userWithTableReadPermission =
+ hdfsAclHelper.getUsersWithTableReadAction(tableName);
+ users.addAll(userWithTableReadPermission);
+ hdfsAclHelper.addTableAcl(tableName, users);
+ try (Table aclTable =
Review comment:
Also can abstract a method for the flag updating
----------------------------------------------------------------
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