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 TypeMethodDescriptionboolean
abortProcedure
(long procId, boolean mayInterruptIfRunning) Abort a procedure.long
addColumn
(TableName tableName, ColumnFamilyDescriptor column, long nonceGroup, long nonce) Add a new column to an existing tablelong
addReplicationPeer
(String peerId, ReplicationPeerConfig peerConfig, boolean enabled) Add a new replication peer for replicating data to slave clustervoid
Called when a new RegionServer is added to the cluster.void
checkTableModifiable
(TableName tableName) Check table is modifiable; i.e.long
createSystemTable
(TableDescriptor tableDescriptor) Create a system table using the given table definition.long
createTable
(TableDescriptor desc, byte[][] splitKeys, long nonceGroup, long nonce) Create a table using the given table definition.long
deleteColumn
(TableName tableName, byte[] columnName, long nonceGroup, long nonce) Delete a column from an existing tablelong
deleteTable
(TableName tableName, long nonceGroup, long nonce) Delete a tablelong
disableReplicationPeer
(String peerId) Stop the replication stream to the specified peerlong
disableTable
(TableName tableName, long nonceGroup, long nonce) Disable an existing tablelong
enableReplicationPeer
(String peerId) Restart the replication stream to the specified peerlong
enableTable
(TableName tableName, long nonceGroup, long nonce) Enable an existing tableExecute region plans with throttlingvoid
Flush master local regionlong
flushTable
(TableName tableName, List<byte[]> columnFamilies, long nonceGroup, long nonce) Flush an existing tableReturns theAccessChecker
Returns Master's instance of theAssignmentManager
Returns Master's instance ofCatalogJanitor
Returns Master's instance ofClusterSchema
Returns Master's instance ofExecutorService
Returns Favored Nodes ManagerReturns Master's instance ofHbckChore
Returns Tripped when Master has finished initialization.long
long
getLastMajorCompactionTimestampForRegion
(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 balancerReturnsLockManager
to lock namespaces/tables/regions.getLocks()
Get locksReturns Master's instance ofMasterCoprocessorHost
Returns Master's filesystemMasterFileSystem
utility class.Returns Master's instance ofMetricsMaster
Returns Master's instance ofProcedureExecutor
Returns the underlying MasterProcedureManagerHostReturns Master's instance ofMasterQuotaManager
Returns Master's WALsMasterWalManager
utility class.Get the meta location syncer.Get proceduresReturns Master's instance ofRegionNormalizerManager
getReplicationPeerConfig
(String peerId) Returns the configured ReplicationPeerConfig for the specified peerReturns theReplicationPeerManager
.Returns Master'sServerManager
instance.Returns the underlying snapshot managerdefault SplitWALManager
Returns return null if current is zk-based WAL splittingReturns Return table descriptors implementation.Returns Master's instance ofTableStateManager
Returns theZKPermissionWatcher
boolean
Returns true if master is the active oneboolean
Returns True if cluster is up; false if cluster is not up (we are shutting down).boolean
Returns true if master is initializedboolean
boolean
boolean
isSplitOrMergeEnabled
(MasterSwitchType switchType) listReplicationPeers
(String regex) Return a list of replication peers.Get list of table descriptors by namespaceGet list of table names by namespacelong
mergeRegions
(RegionInfo[] regionsToMerge, boolean forcible, long nonceGroup, long nonce) Merge regions in a table.long
modifyColumn
(TableName tableName, ColumnFamilyDescriptor descriptor, long nonceGroup, long nonce) Modify the column descriptor of an existing column in an existing tablelong
modifyColumnStoreFileTracker
(TableName tableName, byte[] family, String dstSFT, long nonceGroup, long nonce) Modify the store file tracker of an existing column in an existing tabledefault long
modifyTable
(TableName tableName, TableDescriptor descriptor, long nonceGroup, long nonce) Modify the descriptor of an existing tablelong
modifyTable
(TableName tableName, TableDescriptor descriptor, long nonceGroup, long nonce, boolean reopenRegions) Modify the descriptor of an existing tablelong
modifyTableStoreFileTracker
(TableName tableName, String dstSFT, long nonceGroup, long nonce) Modify the store file tracker of an existing tableboolean
normalizeRegions
(NormalizeTableFilterParams ntfp, boolean isHighPriority) Perform normalization of cluster.boolean
registerService
(com.google.protobuf.Service instance) Registers a new protocol bufferService
subclass as a master coprocessor endpoint.long
removeReplicationPeer
(String peerId) Removes a peer and stops the replicationboolean
replicationPeerModificationSwitch
(boolean on) void
Run the ReplicationBarrierChore.boolean
skipRegionManagementAction
(String action) Checks master state before initiating action over region topology.long
splitRegion
(RegionInfo regionInfo, byte[] splitRow, long nonceGroup, long nonce) Split a region.long
truncateRegion
(RegionInfo regionInfo, long nonceGroup, long nonce) Truncate regionlong
truncateTable
(TableName tableName, boolean preserveSplits, long nonceGroup, long nonce) Truncate a tablelong
updateReplicationPeerConfig
(String peerId, ReplicationPeerConfig peerConfig) Update the peerConfig for the specified peerMethods inherited from interface org.apache.hadoop.hbase.Server
createConnection, getChoreService, getClusterConnection, 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 filesystemMasterFileSystem
utility class. -
getMasterWalManager
Returns Master's WALsMasterWalManager
utility class. -
getServerManager
Returns Master'sServerManager
instance. -
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:
IOException
TableNotFoundException
TableNotDisabledException
-
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 bufferService
subclass as a master coprocessor endpoint. Only a single instance may be registered for a givenService
subclass (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
- theService
subclass instance to expose as a coprocessor endpoint- Returns:
true
if the registration was successful,false
otherwise
-
isActiveMaster
boolean isActiveMaster()Returns true if master is 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:
true
when the caller should exit early,false
otherwise.
-
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:
ReplicationException
IOException
-
removeReplicationPeer
Removes a peer and stops the replication- Parameters:
peerId
- a short name that identifies the peer- Throws:
ReplicationException
IOException
-
enableReplicationPeer
Restart the replication stream to the specified peer- Parameters:
peerId
- a short name that identifies the peer- Throws:
ReplicationException
IOException
-
disableReplicationPeer
Stop the replication stream to the specified peer- Parameters:
peerId
- a short name that identifies the peer- Throws:
ReplicationException
IOException
-
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:
ReplicationException
IOException
-
getReplicationPeerManager
Returns theReplicationPeerManager
. -
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:
ReplicationException
IOException
-
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:
ReplicationException
IOException
-
replicationPeerModificationSwitch
- Throws:
IOException
-
isReplicationPeerModificationEnabled
boolean isReplicationPeerModificationEnabled() -
getLockManager
ReturnsLockManager
to 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. -
normalizeRegions
boolean normalizeRegions(NormalizeTableFilterParams ntfp, boolean isHighPriority) throws IOException Perform normalization of cluster.- Parameters:
ntfp
- Selection criteria for identifying which tables to normalize.isHighPriority
-true
when these requested tables should skip to the front of the queue.- Returns:
true
when the request was submitted,false
otherwise.- 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
-