HBASE-27469 IllegalArgumentException is thrown by SnapshotScannerHDFSAclController when dropping a table (#4865)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
parent
047f4e22e0
commit
e5463e8f4e
|
@ -555,7 +555,7 @@ public class SnapshotScannerHDFSAclController implements MasterCoprocessor, Mast
|
||||||
if (aclTableInitialized) {
|
if (aclTableInitialized) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
LOG.warn("Skip set HDFS acls because acl table is not initialized when " + operation);
|
LOG.warn("Skip set HDFS acls because acl table is not initialized when {}", operation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -610,7 +610,7 @@ public class SnapshotScannerHDFSAclController implements MasterCoprocessor, Mast
|
||||||
PermissionStorage.isGlobalEntry(entry)
|
PermissionStorage.isGlobalEntry(entry)
|
||||||
|| (PermissionStorage.isNamespaceEntry(entry)
|
|| (PermissionStorage.isNamespaceEntry(entry)
|
||||||
&& Bytes.equals(PermissionStorage.fromNamespaceEntry(entry), namespace))
|
&& Bytes.equals(PermissionStorage.fromNamespaceEntry(entry), namespace))
|
||||||
|| (!Bytes.equals(tableName.getName(), entry)
|
|| (PermissionStorage.isTableEntry(entry) && !Bytes.equals(tableName.getName(), entry)
|
||||||
&& Bytes.equals(TableName.valueOf(entry).getNamespace(), namespace))
|
&& Bytes.equals(TableName.valueOf(entry).getNamespace(), namespace))
|
||||||
) {
|
) {
|
||||||
remove = false;
|
remove = false;
|
||||||
|
|
|
@ -654,7 +654,7 @@ public class TestSnapshotScannerHDFSAclController {
|
||||||
// delete table
|
// delete table
|
||||||
admin.disableTable(table);
|
admin.disableTable(table);
|
||||||
admin.deleteTable(table);
|
admin.deleteTable(table);
|
||||||
// grantUser2 and grantUser3 should have data/ns acl
|
// grantUser2 should have data/ns acl
|
||||||
TestHDFSAclHelper.canUserScanSnapshot(TEST_UTIL, grantUser1, snapshot1, -1);
|
TestHDFSAclHelper.canUserScanSnapshot(TEST_UTIL, grantUser1, snapshot1, -1);
|
||||||
TestHDFSAclHelper.canUserScanSnapshot(TEST_UTIL, grantUser2, snapshot1, 6);
|
TestHDFSAclHelper.canUserScanSnapshot(TEST_UTIL, grantUser2, snapshot1, 6);
|
||||||
assertTrue(hasUserNamespaceHdfsAcl(aclTable, grantUserName2, namespace));
|
assertTrue(hasUserNamespaceHdfsAcl(aclTable, grantUserName2, namespace));
|
||||||
|
@ -673,6 +673,26 @@ public class TestSnapshotScannerHDFSAclController {
|
||||||
deleteTable(table);
|
deleteTable(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteTable2() throws Exception {
|
||||||
|
String namespace1 = name.getMethodName() + "1";
|
||||||
|
String namespace2 = name.getMethodName() + "2";
|
||||||
|
String grantUser = name.getMethodName();
|
||||||
|
TableName table = TableName.valueOf(namespace1, name.getMethodName());
|
||||||
|
|
||||||
|
TestHDFSAclHelper.createTableAndPut(TEST_UTIL, table);
|
||||||
|
// grant user table permission
|
||||||
|
TestHDFSAclHelper.grantOnTable(TEST_UTIL, grantUser, table, READ);
|
||||||
|
// grant user other namespace permission
|
||||||
|
SecureTestUtil.grantOnNamespace(TEST_UTIL, grantUser, namespace2, READ);
|
||||||
|
// delete table
|
||||||
|
admin.disableTable(table);
|
||||||
|
admin.deleteTable(table);
|
||||||
|
// grantUser should have namespace2's acl
|
||||||
|
assertFalse(hasUserTableHdfsAcl(aclTable, grantUser, table));
|
||||||
|
assertTrue(hasUserNamespaceHdfsAcl(aclTable, grantUser, namespace2));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteNamespace() throws Exception {
|
public void testDeleteNamespace() throws Exception {
|
||||||
String grantUserName = name.getMethodName();
|
String grantUserName = name.getMethodName();
|
||||||
|
|
Loading…
Reference in New Issue