@InterfaceAudience.LimitedPrivate(value="Configuration") public class SnapshotScannerHDFSAclController extends Object implements MasterCoprocessor, MasterObserver
To use this feature, please mask sure HDFS config:
The implementation of this feature is as followings:
Modifier and Type | Class and Description |
---|---|
(package private) static class |
SnapshotScannerHDFSAclController.SnapshotScannerHDFSAclStorage |
Coprocessor.State
Modifier and Type | Field and Description |
---|---|
private boolean |
aclTableInitialized |
private SnapshotScannerHDFSAclHelper |
hdfsAclHelper |
private boolean |
initialized |
private static org.slf4j.Logger |
LOG |
private MasterServices |
masterServices |
private SnapshotScannerHDFSAclHelper.PathHelper |
pathHelper |
private UserProvider |
userProvider
Provider for mapping principal names to Users
|
PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION
Constructor and Description |
---|
SnapshotScannerHDFSAclController() |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
checkInitialized(String operation) |
private Set<String> |
filterUsersToRemoveNsAccessAcl(Table aclTable,
TableName tableName,
Set<String> tablesUsers)
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, when
delete 'ns1:t1', if Bob has global read permission, '@ns1' read permission or
'ns1:other_tables' read permission, then skip remove Bob access acl in ns1Dirs, otherwise,
remove Bob access acl.
|
private User |
getActiveUser(ObserverContext<?> ctx) |
Optional<MasterObserver> |
getMasterObserver() |
private UserPermission |
getUserGlobalPermission(org.apache.hadoop.conf.Configuration conf,
String userName) |
private UserPermission |
getUserNamespacePermission(org.apache.hadoop.conf.Configuration conf,
String userName,
String namespace) |
private UserPermission |
getUserTablePermission(org.apache.hadoop.conf.Configuration conf,
String userName,
TableName tableName) |
private boolean |
isHdfsAclSet(Table aclTable,
String userName) |
private boolean |
isHdfsAclSet(Table aclTable,
String userName,
String namespace) |
private boolean |
isHdfsAclSet(Table aclTable,
String userName,
String namespace,
TableName tableName)
Check if user global/namespace/table HDFS acls is already set
|
private boolean |
isHdfsAclSet(Table aclTable,
String userName,
TableName tableName) |
private boolean |
needHandleTableHdfsAcl(TableDescriptor tableDescriptor,
String operation) |
private boolean |
needHandleTableHdfsAcl(TableName tableName,
String operation) |
private boolean |
needHandleTableHdfsAcl(TablePermission tablePermission) |
void |
postCompletedCreateTableAction(ObserverContext<MasterCoprocessorEnvironment> c,
TableDescriptor desc,
RegionInfo[] regions)
Called after the createTable operation has been requested.
|
void |
postCompletedDeleteTableAction(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName)
Called after
HMaster deletes a table. |
void |
postCompletedSnapshotAction(ObserverContext<MasterCoprocessorEnvironment> c,
SnapshotDescription snapshot,
TableDescriptor tableDescriptor)
Called after the snapshot operation has been completed.
|
void |
postCompletedTruncateTableAction(ObserverContext<MasterCoprocessorEnvironment> c,
TableName tableName)
Called after
HMaster truncates a table. |
void |
postCreateNamespace(ObserverContext<MasterCoprocessorEnvironment> c,
NamespaceDescriptor ns)
Called after the createNamespace operation has been requested.
|
void |
postDeleteNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx,
String namespace)
Called after the deleteNamespace operation has been requested.
|
void |
postGrant(ObserverContext<MasterCoprocessorEnvironment> c,
UserPermission userPermission,
boolean mergeExistingPermissions)
Called after granting user permissions.
|
void |
postModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
TableDescriptor oldDescriptor,
TableDescriptor currentDescriptor)
Called after the modifyTable operation has been requested.
|
void |
postRevoke(ObserverContext<MasterCoprocessorEnvironment> c,
UserPermission userPermission)
Called after revoking user permissions.
|
void |
postStartMaster(ObserverContext<MasterCoprocessorEnvironment> c)
Called immediately after an active master instance has completed initialization.
|
void |
preMasterInitialization(ObserverContext<MasterCoprocessorEnvironment> c)
Call before the master initialization is set to true.
|
void |
preStopMaster(ObserverContext<MasterCoprocessorEnvironment> c)
Called immediately prior to stopping this
HMaster
process. |
private void |
removeUserGlobalHdfsAcl(Table aclTable,
String userName,
UserPermission userPermission) |
private void |
removeUserNamespaceHdfsAcl(Table aclTable,
String userName,
String namespace,
UserPermission userPermission) |
private void |
removeUserTableHdfsAcl(Table aclTable,
String userName,
TableName tableName,
UserPermission userPermission) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getServices, start, stop
postAbortProcedure, postAddReplicationPeer, postAddRSGroup, postAssign, postBalance, postBalanceRSGroup, postBalanceSwitch, postClearDeadServers, postCloneSnapshot, postCompletedDisableTableAction, postCompletedEnableTableAction, postCompletedMergeRegionsAction, postCompletedModifyTableAction, postCompletedModifyTableAction, postCompletedSplitRegionAction, postCreateTable, postDecommissionRegionServers, postDeleteSnapshot, postDeleteTable, postDisableReplicationPeer, postDisableTable, postEnableReplicationPeer, postEnableTable, postGetClusterMetrics, postGetLocks, postGetNamespaceDescriptor, postGetProcedures, postGetReplicationPeerConfig, postGetTableDescriptors, postGetTableNames, postGetUserPermissions, postHasUserPermissions, postIsRpcThrottleEnabled, postListDecommissionedRegionServers, postListNamespaceDescriptors, postListNamespaces, postListReplicationPeers, postListSnapshot, postLockHeartbeat, postMasterStoreFlush, postMergeRegions, postMergeRegionsCommitAction, postModifyColumnFamilyStoreFileTracker, postModifyNamespace, postModifyNamespace, postModifyTable, postModifyTableStoreFileTracker, postMove, postMoveServers, postMoveServersAndTables, postMoveTables, postRecommissionRegionServer, postRegionOffline, postRemoveReplicationPeer, postRemoveRSGroup, postRemoveServers, postRenameRSGroup, postRequestLock, postRestoreSnapshot, postRollBackMergeRegionsAction, postRollBackSplitRegionAction, postSetNamespaceQuota, postSetRegionServerQuota, postSetSplitOrMergeEnabled, postSetTableQuota, postSetUserQuota, postSetUserQuota, postSetUserQuota, postSnapshot, postSwitchExceedThrottleQuota, postSwitchRpcThrottle, postTableFlush, postTruncateTable, postUnassign, postUnassign, postUpdateReplicationPeerConfig, postUpdateRSGroupConfig, preAbortProcedure, preAddReplicationPeer, preAddRSGroup, preAssign, preBalance, preBalanceRSGroup, preBalanceSwitch, preClearDeadServers, preCloneSnapshot, preCreateNamespace, preCreateTable, preCreateTableAction, preCreateTableRegionsInfos, preDecommissionRegionServers, preDeleteNamespace, preDeleteSnapshot, preDeleteTable, preDeleteTableAction, preDisableReplicationPeer, preDisableTable, preDisableTableAction, preEnableReplicationPeer, preEnableTable, preEnableTableAction, preGetClusterMetrics, preGetLocks, preGetNamespaceDescriptor, preGetProcedures, preGetReplicationPeerConfig, preGetTableDescriptors, preGetTableNames, preGetUserPermissions, preGrant, preHasUserPermissions, preIsRpcThrottleEnabled, preListDecommissionedRegionServers, preListNamespaceDescriptors, preListNamespaces, preListReplicationPeers, preListSnapshot, preLockHeartbeat, preMasterStoreFlush, preMergeRegions, preMergeRegionsAction, preMergeRegionsCommitAction, preModifyColumnFamilyStoreFileTracker, preModifyNamespace, preModifyNamespace, preModifyTable, preModifyTable, preModifyTableAction, preModifyTableAction, preModifyTableStoreFileTracker, preMove, preMoveServers, preMoveServersAndTables, preMoveTables, preRecommissionRegionServer, preRegionOffline, preRemoveReplicationPeer, preRemoveRSGroup, preRemoveServers, preRenameRSGroup, preRequestLock, preRestoreSnapshot, preRevoke, preSetNamespaceQuota, preSetRegionServerQuota, preSetSplitOrMergeEnabled, preSetTableQuota, preSetUserQuota, preSetUserQuota, preSetUserQuota, preShutdown, preSnapshot, preSplitRegion, preSplitRegionAction, preSplitRegionAfterMETAAction, preSplitRegionBeforeMETAAction, preSwitchExceedThrottleQuota, preSwitchRpcThrottle, preTableFlush, preTruncateTable, preTruncateTableAction, preUnassign, preUnassign, preUpdateReplicationPeerConfig, preUpdateRSGroupConfig
private static final org.slf4j.Logger LOG
private SnapshotScannerHDFSAclHelper hdfsAclHelper
private SnapshotScannerHDFSAclHelper.PathHelper pathHelper
private MasterServices masterServices
private volatile boolean initialized
private volatile boolean aclTableInitialized
private UserProvider userProvider
public SnapshotScannerHDFSAclController()
public Optional<MasterObserver> getMasterObserver()
getMasterObserver
in interface MasterCoprocessor
public void preMasterInitialization(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException
MasterObserver
HMaster
process.preMasterInitialization
in interface MasterObserver
IOException
public void postStartMaster(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException
MasterObserver
postStartMaster
in interface MasterObserver
IOException
public void preStopMaster(ObserverContext<MasterCoprocessorEnvironment> c)
MasterObserver
HMaster
process.preStopMaster
in interface MasterObserver
public void postCompletedCreateTableAction(ObserverContext<MasterCoprocessorEnvironment> c, TableDescriptor desc, RegionInfo[] regions) throws IOException
MasterObserver
postCompletedCreateTableAction
in interface MasterObserver
c
- the environment to interact with the framework and masterdesc
- the TableDescriptor for the tableregions
- the initial regions created for the tableIOException
public void postCreateNamespace(ObserverContext<MasterCoprocessorEnvironment> c, NamespaceDescriptor ns) throws IOException
MasterObserver
postCreateNamespace
in interface MasterObserver
c
- the environment to interact with the framework and masterns
- the NamespaceDescriptor for the tableIOException
public void postCompletedSnapshotAction(ObserverContext<MasterCoprocessorEnvironment> c, SnapshotDescription snapshot, TableDescriptor tableDescriptor) throws IOException
MasterObserver
postCompletedSnapshotAction
in interface MasterObserver
c
- the environment to interact with the framework and mastersnapshot
- the SnapshotDescriptor for the snapshottableDescriptor
- the TableDescriptor of the table to snapshotIOException
public void postCompletedTruncateTableAction(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName) throws IOException
MasterObserver
HMaster
truncates a table. Called as part
of truncate table procedure and it is async to the truncate RPC call.postCompletedTruncateTableAction
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tableIOException
public void postCompletedDeleteTableAction(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName) throws IOException
MasterObserver
HMaster
deletes a table. Called as part of
delete table procedure and it is async to the delete RPC call.postCompletedDeleteTableAction
in interface MasterObserver
ctx
- the environment to interact with the framework and mastertableName
- the name of the tableIOException
public void postModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, TableDescriptor oldDescriptor, TableDescriptor currentDescriptor) throws IOException
MasterObserver
postModifyTable
in interface MasterObserver
ctx
- the environment to interact with the framework and mastertableName
- the name of the tableoldDescriptor
- descriptor of table before modify operation happenedcurrentDescriptor
- current TableDescriptor of the tableIOException
public void postDeleteNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx, String namespace) throws IOException
MasterObserver
postDeleteNamespace
in interface MasterObserver
ctx
- the environment to interact with the framework and masternamespace
- the name of the namespaceIOException
public void postGrant(ObserverContext<MasterCoprocessorEnvironment> c, UserPermission userPermission, boolean mergeExistingPermissions) throws IOException
MasterObserver
postGrant
in interface MasterObserver
c
- the coprocessor instance's environmentuserPermission
- the user and permissionsmergeExistingPermissions
- True if merge with previous granted permissionsIOException
public void postRevoke(ObserverContext<MasterCoprocessorEnvironment> c, UserPermission userPermission) throws IOException
MasterObserver
postRevoke
in interface MasterObserver
c
- the coprocessor instance's environmentuserPermission
- the user and permissionsIOException
private void removeUserGlobalHdfsAcl(Table aclTable, String userName, UserPermission userPermission) throws IOException
IOException
private void removeUserNamespaceHdfsAcl(Table aclTable, String userName, String namespace, UserPermission userPermission) throws IOException
IOException
private void removeUserTableHdfsAcl(Table aclTable, String userName, TableName tableName, UserPermission userPermission) throws IOException
IOException
private UserPermission getUserGlobalPermission(org.apache.hadoop.conf.Configuration conf, String userName) throws IOException
IOException
private UserPermission getUserNamespacePermission(org.apache.hadoop.conf.Configuration conf, String userName, String namespace) throws IOException
IOException
private UserPermission getUserTablePermission(org.apache.hadoop.conf.Configuration conf, String userName, TableName tableName) throws IOException
IOException
private boolean isHdfsAclSet(Table aclTable, String userName) throws IOException
IOException
private boolean isHdfsAclSet(Table aclTable, String userName, String namespace) throws IOException
IOException
private boolean isHdfsAclSet(Table aclTable, String userName, TableName tableName) throws IOException
IOException
private boolean isHdfsAclSet(Table aclTable, String userName, String namespace, TableName tableName) throws IOException
IOException
@InterfaceAudience.Private boolean checkInitialized(String operation)
private boolean needHandleTableHdfsAcl(TablePermission tablePermission) throws IOException
IOException
private boolean needHandleTableHdfsAcl(TableName tableName, String operation) throws IOException
IOException
private boolean needHandleTableHdfsAcl(TableDescriptor tableDescriptor, String operation)
private User getActiveUser(ObserverContext<?> ctx) throws IOException
IOException
private Set<String> filterUsersToRemoveNsAccessAcl(Table aclTable, TableName tableName, Set<String> tablesUsers) throws IOException
aclTable
- acl tabletableName
- the name of the tabletablesUsers
- table users setIOException
- if an error occurredCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.