Package org.apache.hadoop.hbase.master
Interface MasterServices
- All Known Implementing Classes:
HMaster,HMasterCommandLine.LocalHMaster
A curated subset of services provided by
HMaster. For use internally only. Passed to
Managers, Services and Chores so can pass less-than-a full-on HMaster at test-time. Be judicious
adding API. Changes cause ripples through the code base.-
Method Summary
Modifier and TypeMethodDescriptionbooleanabortProcedure(long procId, boolean mayInterruptIfRunning) Abort a procedure.longaddColumn(TableName tableName, ColumnFamilyDescriptor column, long nonceGroup, long nonce) Add a new column to an existing tablelongaddReplicationPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled) Add a new replication peer for replicating data to slave clustervoidCalled when a new RegionServer is added to the cluster.voidcheckTableModifiable(TableName tableName) Check table is modifiable; i.e.longcreateSystemTable(TableDescriptor tableDescriptor) Create a system table using the given table definition.longcreateTable(TableDescriptor desc, byte[][] splitKeys, long nonceGroup, long nonce) Create a table using the given table definition.longdeleteColumn(TableName tableName, byte[] columnName, long nonceGroup, long nonce) Delete a column from an existing tablelongdeleteTable(TableName tableName, long nonceGroup, long nonce) Delete a tablelongdisableReplicationPeer(String peerId) Stop the replication stream to the specified peerlongdisableTable(TableName tableName, long nonceGroup, long nonce) Disable an existing tablelongenableReplicationPeer(String peerId) Restart the replication stream to the specified peerlongenableTable(TableName tableName, long nonceGroup, long nonce) Enable an existing tableExecute region plans with throttlingvoidFlush master local regionlongflushTable(TableName tableName, List<byte[]> columnFamilies, long nonceGroup, long nonce) Flush an existing tableReturns theAccessCheckerReturns Master's instance of theAssignmentManagerReturns Master's instance ofCatalogJanitorReturns Master's instance ofClusterSchemaReturns Master's instance ofExecutorServiceReturns Favored Nodes ManagerReturns Master's instance ofHbckChoreReturns Tripped when Master has finished initialization.longlonggetLastMajorCompactionTimestampForRegion(byte[] regionName) Returns the timestamp of the last successful major compaction for the passed region or 0 if no HFile resulting from a major compaction existsReturns load balancerReturnsLockManagerto lock namespaces/tables/regions.getLocks()Get lockslongReturns timestamp in millis when this master became the active one.Returns Master's instance ofMasterCoprocessorHostReturns Master's filesystemMasterFileSystemutility class.Returns Master's instance ofMetricsMasterReturns Master's instance ofProcedureExecutorReturns the underlying MasterProcedureManagerHostReturns Master's instance ofMasterQuotaManagerReturns Master's WALsMasterWalManagerutility class.Get the meta location syncer.Get proceduresReturns Master's instance ofRegionNormalizerManagerReturns theReplicationLogCleanerBarrier.getReplicationPeerConfig(String peerId) Returns the configured ReplicationPeerConfig for the specified peerReturns theReplicationPeerManager.Returns theRSGroupInfoManagerReturns Master'sServerManagerinstance.Returns the underlying snapshot managerdefault SplitWALManagerReturns return null if current is zk-based WAL splittingReturns the SyncReplicationPeerLock.Returns theSyncReplicationReplayWALManager.Returns Return table descriptors implementation.Returns Master's instance ofTableStateManagerReturns theZKPermissionWatcherbooleanReturns true if master is the active onebooleanQueries the state of theLoadBalancerStateStore.booleanReturns True if cluster is up; false if cluster is not up (we are shutting down).booleanReturns true if master is initializedbooleanbooleanbooleanisSplitOrMergeEnabled(MasterSwitchType switchType) listReplicationPeers(String regex) Return a list of replication peers.Get list of table descriptors by namespaceGet list of table names by namespacelongmergeRegions(RegionInfo[] regionsToMerge, boolean forcible, long nonceGroup, long nonce) Merge regions in a table.longmodifyColumn(TableName tableName, ColumnFamilyDescriptor descriptor, long nonceGroup, long nonce) Modify the column descriptor of an existing column in an existing tablelongmodifyColumnStoreFileTracker(TableName tableName, byte[] family, String dstSFT, long nonceGroup, long nonce) Modify the store file tracker of an existing column in an existing tabledefault longmodifyTable(TableName tableName, TableDescriptor descriptor, long nonceGroup, long nonce) Modify the descriptor of an existing tablelongmodifyTable(TableName tableName, TableDescriptor descriptor, long nonceGroup, long nonce, boolean reopenRegions) Modify the descriptor of an existing tablelongmodifyTableStoreFileTracker(TableName tableName, String dstSFT, long nonceGroup, long nonce) Modify the store file tracker of an existing tablebooleannormalizeRegions(NormalizeTableFilterParams ntfp, boolean isHighPriority) Perform normalization of cluster.booleanregisterService(org.apache.hbase.thirdparty.com.google.protobuf.Service instance) Registers a new protocol bufferServicesubclass as a master coprocessor endpoint.longremoveReplicationPeer(String peerId) Removes a peer and stops the replicationbooleanreplicationPeerModificationSwitch(boolean on) longrollAllWALWriters(long nonceGroup, long nonce) Roll WAL writer for all RegionServersvoidRun the ReplicationBarrierChore.booleanskipRegionManagementAction(String action) Checks master state before initiating action over region topology.longsplitRegion(RegionInfo regionInfo, byte[] splitRow, long nonceGroup, long nonce) Split a region.longtransitReplicationPeerSyncReplicationState(String peerId, SyncReplicationState clusterState) Set current cluster state for a synchronous replication peer.longtruncateRegion(RegionInfo regionInfo, long nonceGroup, long nonce) Truncate regionlongtruncateTable(TableName tableName, boolean preserveSplits, long nonceGroup, long nonce) Truncate a tablelongupdateReplicationPeerConfig(String peerId, ReplicationPeerConfig peerConfig) Update the peerConfig for the specified peerMethods inherited from interface org.apache.hadoop.hbase.Server
createConnection, getAsyncClusterConnection, getAsyncConnection, getChoreService, getConfiguration, getConnection, getCoordinatedStateManager, getFileSystem, getServerName, getZooKeeper, isStopping
-
Method Details
-
getSnapshotManager
Returns the underlying snapshot manager -
getMasterProcedureManagerHost
Returns the underlying MasterProcedureManagerHost -
getClusterSchema
Returns Master's instance ofClusterSchema -
getAssignmentManager
Returns Master's instance of theAssignmentManager -
getMasterFileSystem
Returns Master's filesystemMasterFileSystemutility class. -
getMasterWalManager
Returns Master's WALsMasterWalManagerutility class. -
getServerManager
Returns Master'sServerManagerinstance. -
getExecutorService
Returns Master's instance ofExecutorService -
getTableStateManager
Returns Master's instance ofTableStateManager -
getMasterCoprocessorHost
Returns Master's instance ofMasterCoprocessorHost -
getMasterQuotaManager
Returns Master's instance ofMasterQuotaManager -
getRegionNormalizerManager
Returns Master's instance ofRegionNormalizerManager -
getCatalogJanitor
Returns Master's instance ofCatalogJanitor -
getHbckChore
Returns Master's instance ofHbckChore -
getMasterProcedureExecutor
Returns Master's instance ofProcedureExecutor -
getInitializedEvent
Returns Tripped when Master has finished initialization. -
getMasterMetrics
Returns Master's instance ofMetricsMaster -
checkTableModifiable
void checkTableModifiable(TableName tableName) throws IOException, TableNotFoundException, TableNotDisabledException Check table is modifiable; i.e. exists and is offline.- Parameters:
tableName- Name of table to check.- Throws:
IOExceptionTableNotFoundExceptionTableNotDisabledException
-
createTable
long createTable(TableDescriptor desc, byte[][] splitKeys, long nonceGroup, long nonce) throws IOException Create a table using the given table definition.- Parameters:
desc- The table definitionsplitKeys- Starting row keys for the initial table regions. If null a single region is created.- Throws:
IOException
-
createSystemTable
Create a system table using the given table definition.- Parameters:
tableDescriptor- The system table definition a single region is created.- Throws:
IOException
-
deleteTable
Delete a table- Parameters:
tableName- The table name- Throws:
IOException
-
truncateTable
long truncateTable(TableName tableName, boolean preserveSplits, long nonceGroup, long nonce) throws IOException Truncate a table- Parameters:
tableName- The table namepreserveSplits- True if the splits should be preserved- Throws:
IOException
-
modifyTable
default long modifyTable(TableName tableName, TableDescriptor descriptor, long nonceGroup, long nonce) throws IOException Modify the descriptor of an existing table- Parameters:
tableName- The table namedescriptor- The updated table descriptor- Throws:
IOException
-
modifyTable
long modifyTable(TableName tableName, TableDescriptor descriptor, long nonceGroup, long nonce, boolean reopenRegions) throws IOException Modify the descriptor of an existing table- Parameters:
tableName- The table namedescriptor- The updated table descriptorreopenRegions- Whether to reopen regions after modifying the table descriptor- Throws:
IOException
-
modifyTableStoreFileTracker
long modifyTableStoreFileTracker(TableName tableName, String dstSFT, long nonceGroup, long nonce) throws IOException Modify the store file tracker of an existing table- Throws:
IOException
-
enableTable
Enable an existing table- Parameters:
tableName- The table name- Throws:
IOException
-
disableTable
Disable an existing table- Parameters:
tableName- The table name- Throws:
IOException
-
addColumn
long addColumn(TableName tableName, ColumnFamilyDescriptor column, long nonceGroup, long nonce) throws IOException Add a new column to an existing table- Parameters:
tableName- The table namecolumn- The column definition- Throws:
IOException
-
modifyColumn
long modifyColumn(TableName tableName, ColumnFamilyDescriptor descriptor, long nonceGroup, long nonce) throws IOException Modify the column descriptor of an existing column in an existing table- Parameters:
tableName- The table namedescriptor- The updated column definition- Throws:
IOException
-
modifyColumnStoreFileTracker
long modifyColumnStoreFileTracker(TableName tableName, byte[] family, String dstSFT, long nonceGroup, long nonce) throws IOException Modify the store file tracker of an existing column in an existing table- Throws:
IOException
-
deleteColumn
long deleteColumn(TableName tableName, byte[] columnName, long nonceGroup, long nonce) throws IOException Delete a column from an existing table- Parameters:
tableName- The table namecolumnName- The column name- Throws:
IOException
-
mergeRegions
long mergeRegions(RegionInfo[] regionsToMerge, boolean forcible, long nonceGroup, long nonce) throws IOException Merge regions in a table.- Parameters:
regionsToMerge- daughter regions to mergeforcible- whether to force to merge even two regions are not adjacentnonceGroup- used to detect duplicatenonce- used to detect duplicate- Returns:
- procedure Id
- Throws:
IOException
-
splitRegion
long splitRegion(RegionInfo regionInfo, byte[] splitRow, long nonceGroup, long nonce) throws IOException Split a region.- Parameters:
regionInfo- region to splitsplitRow- split pointnonceGroup- used to detect duplicatenonce- used to detect duplicate- Returns:
- procedure Id
- Throws:
IOException
-
getTableDescriptors
Returns Return table descriptors implementation. -
registerService
Registers a new protocol bufferServicesubclass as a master coprocessor endpoint. Only a single instance may be registered for a givenServicesubclass (the instances are keyed onDescriptors.ServiceDescriptor.getFullName(). After the first registration, subsequent calls with the same service name will fail with a return value offalse.- Parameters:
instance- theServicesubclass instance to expose as a coprocessor endpoint- Returns:
trueif the registration was successful,falseotherwise
-
isActiveMaster
boolean isActiveMaster()Returns true if master is the active one -
getMasterActiveTime
long getMasterActiveTime()Returns timestamp in millis when this master became the active one. -
isInitialized
boolean isInitialized()Returns true if master is initialized -
isInMaintenanceMode
boolean isInMaintenanceMode()- Returns:
- true if master is in maintanceMode
- Throws:
IOException- if the inquiry failed due to an IO problem
-
skipRegionManagementAction
Checks master state before initiating action over region topology.- Parameters:
action- the name of the action under consideration, for logging.- Returns:
truewhen the caller should exit early,falseotherwise.
-
abortProcedure
Abort a procedure.- Parameters:
procId- ID of the proceduremayInterruptIfRunning- if the proc completed at least one step, should it be aborted?- Returns:
- true if aborted, false if procedure already completed or does not exist
- Throws:
IOException
-
getProcedures
Get procedures- Returns:
- procedure list
- Throws:
IOException
-
getLocks
Get locks- Returns:
- lock list
- Throws:
IOException
-
listTableDescriptorsByNamespace
Get list of table descriptors by namespace- Parameters:
name- namespace name- Throws:
IOException
-
listTableNamesByNamespace
Get list of table names by namespace- Parameters:
name- namespace name- Returns:
- table names
- Throws:
IOException
-
getLastMajorCompactionTimestamp
- Parameters:
table- the table for which last successful major compaction time is queried- Returns:
- the timestamp of the last successful major compaction for the passed table, or 0 if no HFile resulting from a major compaction exists
- Throws:
IOException
-
getLastMajorCompactionTimestampForRegion
Returns the timestamp of the last successful major compaction for the passed region or 0 if no HFile resulting from a major compaction exists- Throws:
IOException
-
getLoadBalancer
Returns load balancer -
isSplitOrMergeEnabled
-
getFavoredNodesManager
Returns Favored Nodes Manager -
addReplicationPeer
long addReplicationPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled) throws ReplicationException, IOException Add a new replication peer for replicating data to slave cluster- Parameters:
peerId- a short name that identifies the peerpeerConfig- configuration for the replication slave clusterenabled- peer state, true if ENABLED and false if DISABLED- Throws:
ReplicationExceptionIOException
-
removeReplicationPeer
Removes a peer and stops the replication- Parameters:
peerId- a short name that identifies the peer- Throws:
ReplicationExceptionIOException
-
enableReplicationPeer
Restart the replication stream to the specified peer- Parameters:
peerId- a short name that identifies the peer- Throws:
ReplicationExceptionIOException
-
disableReplicationPeer
Stop the replication stream to the specified peer- Parameters:
peerId- a short name that identifies the peer- Throws:
ReplicationExceptionIOException
-
getReplicationPeerConfig
ReplicationPeerConfig getReplicationPeerConfig(String peerId) throws ReplicationException, IOException Returns the configured ReplicationPeerConfig for the specified peer- Parameters:
peerId- a short name that identifies the peer- Returns:
- ReplicationPeerConfig for the peer
- Throws:
ReplicationExceptionIOException
-
getReplicationPeerManager
Returns theReplicationPeerManager. -
getReplicationLogCleanerBarrier
Returns theReplicationLogCleanerBarrier. It will be used at multiple places so we put it in MasterServices directly. -
getSyncReplicationPeerLock
Returns the SyncReplicationPeerLock. -
getSyncReplicationReplayWALManager
Returns theSyncReplicationReplayWALManager. -
updateReplicationPeerConfig
long updateReplicationPeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws ReplicationException, IOException Update the peerConfig for the specified peer- Parameters:
peerId- a short name that identifies the peerpeerConfig- new config for the peer- Throws:
ReplicationExceptionIOException
-
listReplicationPeers
List<ReplicationPeerDescription> listReplicationPeers(String regex) throws ReplicationException, IOException Return a list of replication peers.- Parameters:
regex- The regular expression to match peer id- Returns:
- a list of replication peers description
- Throws:
ReplicationExceptionIOException
-
transitReplicationPeerSyncReplicationState
long transitReplicationPeerSyncReplicationState(String peerId, SyncReplicationState clusterState) throws ReplicationException, IOException Set current cluster state for a synchronous replication peer.- Parameters:
peerId- a short name that identifies the peerclusterState- state of current cluster- Throws:
ReplicationExceptionIOException
-
replicationPeerModificationSwitch
- Throws:
IOException
-
isReplicationPeerModificationEnabled
boolean isReplicationPeerModificationEnabled() -
getLockManager
ReturnsLockManagerto lock namespaces/tables/regions. -
getRegionServerVersion
-
checkIfShouldMoveSystemRegionAsync
Called when a new RegionServer is added to the cluster. Checks if new server has a newer version than any existing server and will move system tables there if so. -
getClientIdAuditPrefix
-
isClusterUp
boolean isClusterUp()Returns True if cluster is up; false if cluster is not up (we are shutting down). -
getSplitWALManager
Returns return null if current is zk-based WAL splitting -
getAccessChecker
Returns theAccessChecker -
getZKPermissionWatcher
Returns theZKPermissionWatcher -
executeRegionPlansWithThrottling
Execute region plans with throttling- Parameters:
plans- to execute- Returns:
- succeeded plans
-
runReplicationBarrierCleaner
void runReplicationBarrierCleaner()Run the ReplicationBarrierChore. -
getRSGroupInfoManager
Returns theRSGroupInfoManager -
isBalancerOn
boolean isBalancerOn()Queries the state of theLoadBalancerStateStore. If the balancer is not initialized, false is returned.- Returns:
- The state of the load balancer, or false if the load balancer isn't defined.
-
normalizeRegions
boolean normalizeRegions(NormalizeTableFilterParams ntfp, boolean isHighPriority) throws IOException Perform normalization of cluster.- Parameters:
ntfp- Selection criteria for identifying which tables to normalize.isHighPriority-truewhen these requested tables should skip to the front of the queue.- Returns:
truewhen the request was submitted,falseotherwise.- Throws:
IOException
-
getMetaLocationSyncer
Get the meta location syncer. We need to get this in MTP to tell the syncer the new meta replica count. -
flushMasterStore
Flush master local region- Throws:
IOException
-
flushTable
long flushTable(TableName tableName, List<byte[]> columnFamilies, long nonceGroup, long nonce) throws IOException Flush an existing table- Parameters:
tableName- The table namecolumnFamilies- The column families to flushnonceGroup- the nonce groupnonce- the nonce- Returns:
- the flush procedure id
- Throws:
IOException
-
truncateRegion
Truncate region- Parameters:
regionInfo- region to be truncatednonceGroup- the nonce groupnonce- the nonce- Returns:
- procedure Id
- Throws:
IOException
-
rollAllWALWriters
Roll WAL writer for all RegionServers- Returns:
- procedure id
- Throws:
IOException
-