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_r303277299
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SnapshotScannerHDFSAclController.java
 ##########
 @@ -138,161 +142,185 @@ public void 
preMasterInitialization(ObserverContext<MasterCoprocessorEnvironment
 
   @Override
   public void postStartMaster(ObserverContext<MasterCoprocessorEnvironment> c) 
throws IOException {
-    if (checkInitialized()) {
-      try (Admin admin = c.getEnvironment().getConnection().getAdmin()) {
-        if (admin.tableExists(PermissionStorage.ACL_TABLE_NAME)) {
-          // Check if hbase acl table has 'm' CF, if not, add 'm' CF
-          TableDescriptor tableDescriptor = 
admin.getDescriptor(PermissionStorage.ACL_TABLE_NAME);
-          boolean containHdfsAclFamily =
-              
Arrays.stream(tableDescriptor.getColumnFamilies()).anyMatch(family -> Bytes
-                  .equals(family.getName(), 
SnapshotScannerHDFSAclStorage.HDFS_ACL_FAMILY));
-          if (!containHdfsAclFamily) {
-            TableDescriptorBuilder builder = 
TableDescriptorBuilder.newBuilder(tableDescriptor)
-                .setColumnFamily(ColumnFamilyDescriptorBuilder
-                    
.newBuilder(SnapshotScannerHDFSAclStorage.HDFS_ACL_FAMILY).build());
-            admin.modifyTable(builder.build());
+    if (!initialized) {
+      return;
+    }
+    try (Admin admin = c.getEnvironment().getConnection().getAdmin()) {
+      if (admin.tableExists(PermissionStorage.ACL_TABLE_NAME)) {
+        // Check if acl table has 'm' CF, if not, add 'm' CF
+        TableDescriptor tableDescriptor = 
admin.getDescriptor(PermissionStorage.ACL_TABLE_NAME);
+        boolean containHdfsAclFamily = 
Arrays.stream(tableDescriptor.getColumnFamilies()).anyMatch(
+          family -> Bytes.equals(family.getName(), 
SnapshotScannerHDFSAclStorage.HDFS_ACL_FAMILY));
+        if (!containHdfsAclFamily) {
+          TableDescriptorBuilder builder = 
TableDescriptorBuilder.newBuilder(tableDescriptor)
+              .setColumnFamily(ColumnFamilyDescriptorBuilder
+                  
.newBuilder(SnapshotScannerHDFSAclStorage.HDFS_ACL_FAMILY).build());
+          admin.modifyTable(builder.build());
+        }
+        // wait until acl table is online
+        List<RegionInfo> tableRegions = MetaTableAccessor.getTableRegions(
 
 Review comment:
   Why to wait & assign the hbase:acl region ?  In theory, the modifyTable will 
ensure that all of the regions are online.

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