@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, waitgetServices, start, stoppostAbortProcedure, 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, postMergeRegions, postMergeRegionsCommitAction, postModifyNamespace, postModifyNamespace, postModifyTable, 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, postUpdateReplicationPeerConfig, 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, preMergeRegions, preMergeRegionsAction, preMergeRegionsCommitAction, preModifyNamespace, preModifyNamespace, preModifyTable, preModifyTable, preModifyTableAction, preModifyTableAction, 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, preUpdateReplicationPeerConfigprivate 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 MasterCoprocessorpublic void preMasterInitialization(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException
MasterObserverHMaster process.preMasterInitialization in interface MasterObserverIOExceptionpublic void postStartMaster(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException
MasterObserverpostStartMaster in interface MasterObserverIOExceptionpublic void preStopMaster(ObserverContext<MasterCoprocessorEnvironment> c)
MasterObserverHMaster process.preStopMaster in interface MasterObserverpublic void postCompletedCreateTableAction(ObserverContext<MasterCoprocessorEnvironment> c, TableDescriptor desc, RegionInfo[] regions) throws IOException
MasterObserverpostCompletedCreateTableAction in interface MasterObserverc - the environment to interact with the framework and masterdesc - the TableDescriptor for the tableregions - the initial regions created for the tableIOExceptionpublic void postCreateNamespace(ObserverContext<MasterCoprocessorEnvironment> c, NamespaceDescriptor ns) throws IOException
MasterObserverpostCreateNamespace in interface MasterObserverc - the environment to interact with the framework and masterns - the NamespaceDescriptor for the tableIOExceptionpublic void postCompletedSnapshotAction(ObserverContext<MasterCoprocessorEnvironment> c, SnapshotDescription snapshot, TableDescriptor tableDescriptor) throws IOException
MasterObserverpostCompletedSnapshotAction in interface MasterObserverc - the environment to interact with the framework and mastersnapshot - the SnapshotDescriptor for the snapshottableDescriptor - the TableDescriptor of the table to snapshotIOExceptionpublic void postCompletedTruncateTableAction(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName) throws IOException
MasterObserverHMaster truncates a
table. Called as part of truncate table procedure and it is async to the
truncate RPC call.postCompletedTruncateTableAction in interface MasterObserverc - the environment to interact with the framework and mastertableName - the name of the tableIOExceptionpublic void postCompletedDeleteTableAction(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName) throws IOException
MasterObserverHMaster deletes a
table. Called as part of delete table procedure and it is async to the
delete RPC call.postCompletedDeleteTableAction in interface MasterObserverctx - the environment to interact with the framework and mastertableName - the name of the tableIOExceptionpublic void postModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, TableDescriptor oldDescriptor, TableDescriptor currentDescriptor) throws IOException
MasterObserverpostModifyTable in interface MasterObserverctx - 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 tableIOExceptionpublic void postDeleteNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx, String namespace) throws IOException
MasterObserverpostDeleteNamespace in interface MasterObserverctx - the environment to interact with the framework and masternamespace - the name of the namespaceIOExceptionpublic void postGrant(ObserverContext<MasterCoprocessorEnvironment> c, UserPermission userPermission, boolean mergeExistingPermissions) throws IOException
MasterObserverpostGrant in interface MasterObserverc - the coprocessor instance's environmentuserPermission - the user and permissionsmergeExistingPermissions - True if merge with previous granted permissionsIOExceptionpublic void postRevoke(ObserverContext<MasterCoprocessorEnvironment> c, UserPermission userPermission) throws IOException
MasterObserverpostRevoke in interface MasterObserverc - the coprocessor instance's environmentuserPermission - the user and permissionsIOExceptionprivate void removeUserGlobalHdfsAcl(Table aclTable, String userName, UserPermission userPermission) throws IOException
IOExceptionprivate void removeUserNamespaceHdfsAcl(Table aclTable, String userName, String namespace, UserPermission userPermission) throws IOException
IOExceptionprivate void removeUserTableHdfsAcl(Table aclTable, String userName, TableName tableName, UserPermission userPermission) throws IOException
IOExceptionprivate UserPermission getUserGlobalPermission(org.apache.hadoop.conf.Configuration conf, String userName) throws IOException
IOExceptionprivate UserPermission getUserNamespacePermission(org.apache.hadoop.conf.Configuration conf, String userName, String namespace) throws IOException
IOExceptionprivate UserPermission getUserTablePermission(org.apache.hadoop.conf.Configuration conf, String userName, TableName tableName) throws IOException
IOExceptionprivate boolean isHdfsAclSet(Table aclTable, String userName) throws IOException
IOExceptionprivate boolean isHdfsAclSet(Table aclTable, String userName, String namespace) throws IOException
IOExceptionprivate boolean isHdfsAclSet(Table aclTable, String userName, TableName tableName) throws IOException
IOExceptionprivate boolean isHdfsAclSet(Table aclTable, String userName, String namespace, TableName tableName) throws IOException
IOExceptionboolean checkInitialized(String operation)
private boolean needHandleTableHdfsAcl(TablePermission tablePermission) throws IOException
IOExceptionprivate boolean needHandleTableHdfsAcl(TableName tableName, String operation) throws IOException
IOExceptionprivate boolean needHandleTableHdfsAcl(TableDescriptor tableDescriptor, String operation)
private User getActiveUser(ObserverContext<?> ctx) throws IOException
IOExceptionprivate 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.