From 29a36568b1665182b1e417315a79223f623e71f5 Mon Sep 17 00:00:00 2001 From: meiyi Date: Tue, 11 Feb 2020 01:40:05 +0800 Subject: [PATCH] HBASE-23824 TestSnapshotScannerHDFSAclController is flakey (#1157) Signed-off-by: stack --- .../SnapshotScannerHDFSAclController.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SnapshotScannerHDFSAclController.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SnapshotScannerHDFSAclController.java index 82e3430b9c7..5c4ba0d6850 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SnapshotScannerHDFSAclController.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SnapshotScannerHDFSAclController.java @@ -222,9 +222,9 @@ public class SnapshotScannerHDFSAclController implements MasterCoprocessor, Mast } @Override - public void postDeleteTable(ObserverContext ctx, + public void postCompletedDeleteTableAction(ObserverContext ctx, TableName tableName) throws IOException { - if (needHandleTableHdfsAcl(tableName, "deleteTable " + tableName)) { + if (!tableName.isSystemTable() && checkInitialized("deleteTable " + tableName)) { /* * Remove table user access HDFS acl from namespace directory if the user has no permissions * of global, ns of the table or other tables of the ns, eg: Bob has 'ns1:t1' read permission, @@ -235,14 +235,16 @@ public class SnapshotScannerHDFSAclController implements MasterCoprocessor, Mast try (Table aclTable = ctx.getEnvironment().getConnection().getTable(PermissionStorage.ACL_TABLE_NAME)) { Set users = SnapshotScannerHDFSAclStorage.getTableUsers(aclTable, tableName); - // 1. Remove table archive directory default ACLs - hdfsAclHelper.removeTableDefaultAcl(tableName, users); - // 2. Delete table owner permission is synced to HDFS in acl table - SnapshotScannerHDFSAclStorage.deleteTableHdfsAcl(aclTable, tableName); - // 3. Remove namespace access acls - Set removeUsers = filterUsersToRemoveNsAccessAcl(aclTable, tableName, users); - if (removeUsers.size() > 0) { - hdfsAclHelper.removeNamespaceAccessAcl(tableName, removeUsers, "delete"); + if (users.size() > 0) { + // 1. Remove table archive directory default ACLs + hdfsAclHelper.removeTableDefaultAcl(tableName, users); + // 2. Delete table owner permission is synced to HDFS in acl table + SnapshotScannerHDFSAclStorage.deleteTableHdfsAcl(aclTable, tableName); + // 3. Remove namespace access acls + Set removeUsers = filterUsersToRemoveNsAccessAcl(aclTable, tableName, users); + if (removeUsers.size() > 0) { + hdfsAclHelper.removeNamespaceAccessAcl(tableName, removeUsers, "delete"); + } } } }