@InterfaceAudience.LimitedPrivate(value="Configuration") public class CoprocessorWhitelistMasterObserver extends Object implements MasterCoprocessor, MasterObserver
Coprocessor.State
Modifier and Type | Field and Description |
---|---|
static String |
CP_COPROCESSOR_WHITELIST_PATHS_KEY |
private static org.slf4j.Logger |
LOG |
PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION
Constructor and Description |
---|
CoprocessorWhitelistMasterObserver() |
Modifier and Type | Method and Description |
---|---|
Optional<MasterObserver> |
getMasterObserver() |
void |
preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableDescriptor htd,
RegionInfo[] regions)
Called before a new table is created by
HMaster . |
TableDescriptor |
preModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
TableDescriptor currentDesc,
TableDescriptor newDesc)
Called prior to modifying a table's properties.
|
private static boolean |
validatePath(org.apache.hadoop.fs.Path coprocPath,
org.apache.hadoop.fs.Path wlPath)
Validates a single whitelist path against the coprocessor path
|
private static void |
verifyCoprocessors(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableDescriptor htd)
Perform the validation checks for a coprocessor to determine if the path
is white listed or not.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getServices, start, stop
postAbortProcedure, postAddReplicationPeer, postAddRSGroup, postAssign, postBalance, postBalanceRSGroup, postBalanceSwitch, postClearDeadServers, postCloneSnapshot, postCompletedCreateTableAction, postCompletedDeleteTableAction, postCompletedDisableTableAction, postCompletedEnableTableAction, postCompletedMergeRegionsAction, postCompletedModifyTableAction, postCompletedModifyTableAction, postCompletedSplitRegionAction, postCompletedTruncateTableAction, postCreateNamespace, postCreateTable, postDecommissionRegionServers, postDeleteNamespace, postDeleteSnapshot, postDeleteTable, postDisableReplicationPeer, postDisableTable, postEnableReplicationPeer, postEnableTable, postGetClusterMetrics, postGetLocks, postGetNamespaceDescriptor, postGetProcedures, postGetReplicationPeerConfig, postGetTableDescriptors, postGetTableNames, postGetUserPermissions, postGrant, postHasUserPermissions, postIsRpcThrottleEnabled, postListDecommissionedRegionServers, postListNamespaceDescriptors, postListReplicationPeers, postListSnapshot, postLockHeartbeat, postMergeRegions, postMergeRegionsCommitAction, postModifyNamespace, postModifyNamespace, postModifyTable, postModifyTable, postMove, postMoveServers, postMoveServersAndTables, postMoveTables, postRecommissionRegionServer, postRegionOffline, postRemoveReplicationPeer, postRemoveRSGroup, postRemoveServers, postRequestLock, postRestoreSnapshot, postRevoke, postRollBackMergeRegionsAction, postRollBackSplitRegionAction, postSetNamespaceQuota, postSetRegionServerQuota, postSetSplitOrMergeEnabled, postSetTableQuota, postSetUserQuota, postSetUserQuota, postSetUserQuota, postSnapshot, postStartMaster, postSwitchExceedThrottleQuota, postSwitchRpcThrottle, postTableFlush, postTruncateTable, postUnassign, postUpdateReplicationPeerConfig, preAbortProcedure, preAddReplicationPeer, preAddRSGroup, preAssign, preBalance, preBalanceRSGroup, preBalanceSwitch, preClearDeadServers, preCloneSnapshot, preCreateNamespace, 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, preListReplicationPeers, preListSnapshot, preLockHeartbeat, preMasterInitialization, preMergeRegions, preMergeRegionsAction, preMergeRegionsCommitAction, preModifyNamespace, preModifyNamespace, preModifyTable, preModifyTableAction, preModifyTableAction, preMove, preMoveServers, preMoveServersAndTables, preMoveTables, preRecommissionRegionServer, preRegionOffline, preRemoveReplicationPeer, preRemoveRSGroup, preRemoveServers, preRequestLock, preRestoreSnapshot, preRevoke, preSetNamespaceQuota, preSetRegionServerQuota, preSetSplitOrMergeEnabled, preSetTableQuota, preSetUserQuota, preSetUserQuota, preSetUserQuota, preShutdown, preSnapshot, preSplitRegion, preSplitRegionAction, preSplitRegionAfterMETAAction, preSplitRegionBeforeMETAAction, preStopMaster, preSwitchExceedThrottleQuota, preSwitchRpcThrottle, preTableFlush, preTruncateTable, preTruncateTableAction, preUnassign, preUpdateReplicationPeerConfig
public static final String CP_COPROCESSOR_WHITELIST_PATHS_KEY
private static final org.slf4j.Logger LOG
public CoprocessorWhitelistMasterObserver()
public Optional<MasterObserver> getMasterObserver()
getMasterObserver
in interface MasterCoprocessor
public TableDescriptor preModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, TableDescriptor currentDesc, TableDescriptor newDesc) throws IOException
MasterObserver
preModifyTable
in interface MasterObserver
ctx
- the environment to interact with the framework and mastertableName
- the name of the tablecurrentDesc
- current TableDescriptor of the tablenewDesc
- after modify operation, table will have this descriptorIOException
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableDescriptor htd, RegionInfo[] regions) throws IOException
MasterObserver
HMaster
. Called as part of create
table RPC call.preCreateTable
in interface MasterObserver
ctx
- the environment to interact with the framework and masterhtd
- the TableDescriptor for the tableregions
- the initial regions created for the tableIOException
private static boolean validatePath(org.apache.hadoop.fs.Path coprocPath, org.apache.hadoop.fs.Path wlPath)
coprocPath
- the path to the coprocessor including schemewlPath
- can be:
1) a "*" to wildcard all coprocessor paths
2) a specific filesystem (e.g. hdfs://my-cluster/)
3) a wildcard path to be evaluated by
FilenameUtils.wildcardMatch(String, String)
path can specify scheme or not (e.g.
"file:///usr/hbase/coprocessors" or for all
filesystems "/usr/hbase/coprocessors")private static void verifyCoprocessors(ObserverContext<MasterCoprocessorEnvironment> ctx, TableDescriptor htd) throws IOException
ctx
- as passed in from the coprocessorhtd
- as passed in from the coprocessorIOException
- if path is not included in whitelist or a failure
occurs in processingCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.