Package org.apache.hadoop.hbase.master
Class HMaster
- All Implemented Interfaces:
Runnable,Abortable,ConnectionRegistryEndpoint,ConfigurationObserver,MasterServices,Server,Stoppable
- Direct Known Subclasses:
HMasterCommandLine.LocalHMaster
@LimitedPrivate("Tools")
public class HMaster
extends HBaseServerBase<MasterRpcServices>
implements MasterServices
HMaster is the "master server" for HBase. An HBase cluster has one active master. If many masters
are started, all compete. Whichever wins goes on to run the cluster. All others park themselves
in their constructor until master or cluster shutdown or until the active master loses its lease
in zookeeper. Thereafter, all running master jostle to take over master role.
The Master can be asked shutdown the cluster. See
shutdown(). In this case it will tell
all regionservers to go down and then wait on them all reporting in that they are down. This
master will then shut itself down.
You can also shutdown just this master. Call stopMaster().- See Also:
-
Watcher
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceImplement to return TableDescriptor after pre-checksNested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final ActiveMasterManagerprivate AssignmentManagerprivate RSGroupBasedLoadBalancerprivate BalancerChoreprivate final CachedClusterId(package private) CatalogJanitorprivate Stringprivate ClusterSchemaServiceprivate ClusterStatusChoreprivate ClusterStatusPublisher(package private) MasterCoprocessorHoststatic final intprivate static final Stringstatic final intprivate static final booleanprivate static booleanprivate DrainingServerTrackerprivate DirScanPoolprivate MasterFileSystemstatic final Stringstatic final StringUse RSProcedureDispatcher instance to initiate master -> rs remote procedure execution.static final Stringprivate HbckChoreprivate List<org.apache.hadoop.fs.Path>private List<HFileCleaner>private final ProcedureEvent<?>(package private) LoadBalancerStateStoreprivate final LockManagerprivate static final org.slf4j.Loggerprivate LogCleanerprivate DirScanPool(package private) static final Stringprivate final booleanstatic final Stringprivate long(package private) MasterAddressSyncerprivate longprivate org.apache.hbase.thirdparty.org.eclipse.jetty.server.Serverjetty server for master to redirect requests to regionserver infoServerprivate MasterRegionprivate final intprivate final doubleprivate MetaLocationSyncer(package private) final MetricsMasterprivate final IdLockprivate Map<TableName,AtomicInteger> private MobFileCleanerChoreprivate MobFileCompactionChoreprivate MasterProcedureManagerHostprivate OldWALsDirSizeChoreprivate final booleanprivate ProcedureExecutor<MasterProcedureEnv>private ProcedureStoreprivate MasterQuotaManagerprivate QuotaObserverChoreprivate RegionNormalizerManagerprivate final RegionServerTrackerprivate RegionsRecoveryChoreprivate RegionsRecoveryConfigManagerprivate ReplicationBarrierCleanerprivate final ReplicationLogCleanerBarrierprivate ReplicationPeerManagerStore whether we allow replication peer modification operations.private RollingUpgradeChore(package private) MemoryBoundedLogMessageBufferprivate RSGroupInfoManagerprivate RegionServerListprivate ServerManager(package private) booleanprivate DirScanPoolprivate SnapshotCleanerChore(package private) SnapshotCleanupStateStore(package private) SnapshotManagerprivate SnapshotQuotaObserverChoreprivate SpaceQuotaSnapshotNotifierprivate SplitOrMergeStateStoreprivate SplitWALManagerprivate TaskGroupprivate final Semaphoreprivate SyncReplicationReplayWALManagerprivate TableStateManagerprivate MasterWalManagerstatic final StringFields inherited from class org.apache.hadoop.hbase.HBaseServerBase
abortRequested, asyncClusterConnection, choreService, clusterStatusTracker, conf, configurationManager, csm, dataFs, dataRootDir, eventLoopGroupConfig, executorService, infoServer, metaRegionLocationCache, msgInterval, namedQueueRecorder, rpcServices, serverName, sleeper, startcode, stopped, tableDescriptors, userProvider, useThisHostnameInstead, walFs, walRootDir, zooKeeperFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAbort the server or client.booleanabortProcedure(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 clusterbalance()balance(BalanceRequest request) Trigger a normal balance, seebalance().booleanbalanceSwitch(boolean b) private voidbalanceThrottling(long nextBalanceStartTime, int maxRegionsInTransition, long cutoffTime) It first sleep to the next balance plan start time.private org.apache.hbase.thirdparty.org.eclipse.jetty.ee8.servlet.ServletHolderprivate org.apache.hbase.thirdparty.org.eclipse.jetty.ee8.servlet.ServletHolderprotected booleanprotected booleanprotected booleanvoidCalled when a new RegionServer is added to the cluster.(package private) voidprotected voidprivate voidcheckTableExists(TableName tableName) voidcheckTableModifiable(TableName tableName) Check table is modifiable; i.e.protected booleanprotected voidconfigureInfoServer(InfoServer infoServer) static HMasterconstructMaster(Class<? extends HMaster> masterClass, org.apache.hadoop.conf.Configuration conf) Utility for constructing an instance of the passed HMaster class.protected ActiveMasterManagercreateActiveMasterManager(ZKWatcher zk, ServerName sn, Server server) Protected to have custom implementations in tests override the default ActiveMaster implementation.protected AssignmentManagercreateAssignmentManager(MasterServices master, MasterRegion masterRegion) private voidcreateMissingCFsInMetaDuringUpgrade(TableDescriptor metaDescriptor) protected NamedQueueRecorder(package private) longcreateNamespace(NamespaceDescriptor namespaceDescriptor, long nonceGroup, long nonce) Create a new Namespace.private voidprivate SpaceQuotaSnapshotNotifierprotected MasterRpcServicesprotected ServerManagercreateServerManager(MasterServices master, RegionServerList storage) Create aServerManagerinstance.longcreateSystemTable(TableDescriptor tableDescriptor) Create a system table using the given table definition.longcreateTable(TableDescriptor tableDescriptor, byte[][] splitKeys, long nonceGroup, long nonce) Create a table using the given table definition.voiddecommissionRegionServers(List<ServerName> servers, boolean offload) Mark region server(s) as decommissioned (previously called 'draining') to prevent additional regions from getting assigned to them.static voiddecorateMasterConfiguration(org.apache.hadoop.conf.Configuration conf) This method modifies the master's configuration in order to inject replication-related featureslongdeleteColumn(TableName tableName, byte[] columnName, long nonceGroup, long nonce) Delete a column from an existing table(package private) longdeleteNamespace(String name, long nonceGroup, long nonce) Delete an existing Namespace.longdeleteTable(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 tableprivate longexecutePeerProcedure(AbstractPeerProcedure<?> procedure) Execute region plans with throttlingprivate static voidfilterTablesByRegex(Collection<TableDescriptor> descriptors, Pattern pattern) Removes the table descriptors that don't match the pattern.private voidFinish initialization of HMaster after becoming the primary master.voidFlush master local regionlongflushTable(TableName tableName, List<byte[]> columnFamilies, long nonceGroup, long nonce) Flush an existing tableGet active master address.intReturns info port of active master or 0 if any exception occurs.Returns Master's instance of theAssignmentManagerdoubleCompute the average load across all region servers.intGet backup masters address.Get a iterator of the available bootstrap nodes.Returns Master's instance ofCatalogJanitorReturns Client info for use as prefix on an audit log string; who did an actionGet cluster id.Returns cluster statusgetClusterMetrics(EnumSet<ClusterMetrics.Option> options) Returns Master's instance ofClusterSchemagetCompactionState(TableName tableName) Get the compaction state of the tableprotected MasterCoprocessorHostprotected Class<? extends javax.servlet.http.HttpServlet>Returns 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 balancerFetch the configuredLoadBalancerclass name.static StringThe set of loaded coprocessors is stored in a static set.ReturnsLockManagerto lock namespaces/tables/regions.getLocks()Get lockslongReturns timestamp in millis when HMaster became the active master.Returns Master's instance ofMasterCoprocessorHostString[]Returns array of coprocessor SimpleNames.Returns Master's filesystemMasterFileSystemutility class.longReturns timestamp in millis when HMaster finished becoming the active masterReturns Master's instance ofMetricsMasterReturns Master's instance ofProcedureExecutorReturns the underlying MasterProcedureManagerHostReturns Master's instance ofMasterQuotaManagerlongReturns timestamp in millis when HMaster was started.Returns Master's WALsMasterWalManagerutility class.private intReturns Maximum time we should run balancer forprivate intReturns Maximum number of regions in transitionGet the location of meta regions.Get the meta location syncer.org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionStategetMobCompactionState(TableName tableName) Gets the mob file compaction state for a specific table.(package private) NamespaceDescriptorgetNamespace(String name) Get a Namespace(package private) List<NamespaceDescriptor>Get all Namespacesintprivate Map<ServerName,ServerMetrics> Get proceduresprotected StringReturns Master's instance ofRegionNormalizerManagerint(package private) InetAddressgetRemoteInetAddress(int port, long serverStartCode) Returns Get remote side's InetAddressgetRemoteProcedure(long procId) getReplicationLoad(ServerName[] serverNames) Returns theReplicationLogCleanerBarrier.getReplicationPeerConfig(String peerId) Returns the configured ReplicationPeerConfig for the specified peerReturns theReplicationPeerManager.Returns theRSGroupInfoManagerReturns Master'sServerManagerinstance.Returns The unique server name for this server.Returns the underlying snapshot managerReturns return null if current is zk-based WAL splittingReturns the SyncReplicationPeerLock.Returns theSyncReplicationReplayWALManager.private List<TableDescriptor>getTableDescriptors(List<TableDescriptor> htds, String namespace, String regex, List<TableName> tableNameList, boolean includeSysTables) Return a list of table table descriptors after applying any provided filter parameters.Returns Master's instance ofTableStateManagerprivate List<ServerName>protected StringgetUseThisHostnameInstead(org.apache.hadoop.conf.Configuration conf) protected voidprivate voidinitializeCoprocessorHost(org.apache.hadoop.conf.Configuration conf) private voidInitialize all ZK based system trackers.private voidprivate voidbooleanReport whether this master is currently the active master or not.booleanQueries the state of theLoadBalancerStateStore.booleanprivate static booleanisCatalogTable(TableName tableName) (package private) booleanbooleanReport whether this master has completed with its initialization and is ready.booleanReport whether this master is in maintenance mode.booleanQueries the state of theRegionNormalizerStateStore.booleanisOnline()Report whether this master is started This method is used for testing.private booleanbooleanbooleanisSplitOrMergeEnabled(MasterSwitchType switchType) Queries the state of theSplitOrMergeStateStore.List region servers marked as decommissioned (previously called 'draining') to not get regions assigned to them.List namespace nameslistReplicationPeers(String regex) Return a list of replication peers.listTableDescriptors(String namespace, String regex, List<TableName> tableNameList, boolean includeSysTables) Returns the list of table descriptors that match the specified requestGet list of table descriptors by namespacelistTableNames(String namespace, String regex, boolean includeSysTables) Returns the list of table names that match the specified requestGet list of table names by namespaceprotected voidlogin(UserProvider user, String host) For compatibility, if failed with regionserver credentials, try the master onestatic voidlongmergeRegions(RegionInfo[] regionsToMerge, boolean forcible, long ng, 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 table(package private) longmodifyNamespace(NamespaceDescriptor newNsDescriptor, long nonceGroup, long nonce) Modify an existing Namespace.longmodifyTable(TableName tableName, TableDescriptor newDescriptor, long nonceGroup, long nonce, boolean reopenRegions) Modify the descriptor of an existing tableprivate longmodifyTable(TableName tableName, HMaster.TableDescriptorGetter newDescriptorGetter, long nonceGroup, long nonce, boolean shouldCheckDescriptor) private longmodifyTable(TableName tableName, HMaster.TableDescriptorGetter newDescriptorGetter, long nonceGroup, long nonce, boolean shouldCheckDescriptor, boolean reopenRegions) longmodifyTableStoreFileTracker(TableName tableName, String dstSFT, long nonceGroup, long nonce) Modify the store file tracker of an existing tablevoidmove(byte[] encodedRegionName, byte[] destServerName) booleannormalizeRegions(NormalizeTableFilterParams ntfp, boolean isHighPriority) Perform normalization of cluster.voidonConfigurationChange(org.apache.hadoop.conf.Configuration newConf) This method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.private intvoidrecommissionRegionServer(ServerName server, List<byte[]> encodedRegionNames) Remove decommission marker (previously called 'draining') from a region server to allow regions assignments.private voidbooleanregisterService(org.apache.hbase.thirdparty.com.google.protobuf.Service instance) Registers a new protocol bufferServicesubclass as a master coprocessor endpoint.voidvoidremoteProcedureCompleted(long procId, byte[] remoteResultData) voidremoteProcedureFailed(long procId, RemoteProcedureException error) longremoveReplicationPeer(String peerId) Removes a peer and stops the replication(package private) longreopenRegions(TableName tableName, List<byte[]> regionNames, long nonceGroup, long nonce) Reopen regions provided in the argumentbooleanreplicationPeerModificationSwitch(boolean on) voidreportMobCompactionEnd(TableName tableName) voidreportMobCompactionStart(TableName tableName) longrestoreSnapshot(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDesc, long nonceGroup, long nonce, boolean restoreAcl, String customSFT) longrollAllWALWriters(long nonceGroup, long nonce) Roll WAL writer for all RegionServersvoidrun()voidRun the ReplicationBarrierChore.(package private) voidsetAssignmentManager(AssignmentManager assignmentManager) voidsetCatalogJanitorChoreForTesting(CatalogJanitor catalogJanitorChore) Used for testing only to set Mock objects.voidsetCatalogJanitorEnabled(boolean b) Switch for the background CatalogJanitor thread.(package private) static voidsetDisableBalancerChoreForTest(boolean disable) voidsetHbckChoreForTesting(HbckChore hbckChore) Used for testing only to set Mock objects.voidsetInitialized(boolean isInitialized) (package private) voidsetLoadBalancer(RSGroupBasedLoadBalancer loadBalancer) private voidsetQuotasObserver(org.apache.hadoop.conf.Configuration conf) voidsetServiceStarted(boolean started) Mainly used in procedure related tests, where we will restart ProcedureExecutor and AssignmentManager, but we do not want to restart master(to speed up the test), so we need to disable rpc for a while otherwise some critical rpc requests such as reportRegionStateTransition could fail and cause region server to abort.voidshutdown()Shutdown the cluster.booleanskipRegionManagementAction(String action) Checks master state before initiating action over region topology.longsplitRegion(RegionInfo regionInfo, byte[] splitRow, long nonceGroup, long nonce) Split a region.private voidstartActiveMasterManager(int infoPort) protected voidprivate voidvoidStop this service.protected voidvoidprivate voidprotected voidprivate voidswitchSnapshotCleanup(boolean on) (package private) voidswitchSnapshotCleanup(boolean on, boolean synchronous) Turn on/off Snapshot Cleanup ChorelongtransitReplicationPeerSyncReplicationState(String peerId, SyncReplicationState state) 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 tableprivate voidvoidupdateConfigurationForQuotasObserver(org.apache.hadoop.conf.Configuration conf) Adds theMasterQuotasObserverto the list of configured Master observers to automatically remove quotas for a table when that table is deleted.longupdateReplicationPeerConfig(String peerId, ReplicationPeerConfig peerConfig) Update the peerConfig for the specified peerbooleanCheck hbase:meta is up and ready for reading.private booleanCheck hbase:namespace table is assigned.private voidwaitForRegionServers(MonitoredTask status) private voidwarmUpRegion(ServerName server, RegionInfo region) Methods inherited from class org.apache.hadoop.hbase.HBaseServerBase
closeClusterConnection, closeTableDescriptors, closeZooKeeper, createConnection, getAccessChecker, getAsyncClusterConnection, getChoreService, getConfiguration, getConfigurationManager, getCoordinatedStateManager, getDataRootDir, getEventLoopGroupConfig, getExecutorService, getFileSystem, getInfoServer, getMetaRegionLocationCache, getMsgInterval, getNamedQueueRecorder, getRpcServer, getRpcServices, getStartcode, getTableDescriptors, getWALFileSystem, getWALRootDir, getZKPermissionWatcher, getZooKeeper, initializeFileSystem, initializeMemStoreChunkCreator, installShutdownHook, isAborted, isClusterUp, isShutdownHookInstalled, isStopped, setAbortRequested, setupClusterConnection, shutdownChore, stopChoreService, stopExecutorService, stopInfoServer, toString, updateConfigurationMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yieldMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.master.MasterServices
getAccessChecker, getExecutorService, getTableDescriptors, getZKPermissionWatcher, isClusterUp, modifyTableMethods inherited from interface org.apache.hadoop.hbase.Server
createConnection, getAsyncClusterConnection, getAsyncConnection, getChoreService, getConfiguration, getConnection, getCoordinatedStateManager, getFileSystem, getZooKeeper, isStopping
-
Field Details
-
LOG
-
MASTER
- See Also:
-
activeMasterManager
-
regionServerTracker
-
drainingServerTracker
-
loadBalancerStateStore
-
metaLocationSyncer
-
masterAddressSyncer
-
snapshotCleanupStateStore
-
splitOrMergeStateStore
-
clusterSchemaService
-
HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS
- See Also:
-
DEFAULT_HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS
- See Also:
-
HBASE_MASTER_CLEANER_INTERVAL
- See Also:
-
DEFAULT_HBASE_MASTER_CLEANER_INTERVAL
- See Also:
-
clusterId
-
metricsMaster
-
fileSystemManager
-
walManager
-
splitWALManager
-
serverManager
-
assignmentManager
-
rsGroupInfoManager
-
replicationLogCleanerBarrier
-
syncReplicationPeerLock
-
replicationPeerManager
-
syncReplicationReplayWALManager
-
rsFatals
-
activeMaster
-
initialized
-
serviceStarted
-
maxBalancingTime
-
maxRitPercent
-
lockManager
-
balancer
-
balancerChore
-
disableBalancerChoreForTest
-
regionNormalizerManager
-
clusterStatusChore
-
clusterStatusPublisherChore
-
snapshotCleanerChore
-
hbckChore
-
catalogJanitorChore
-
logCleanerPool
-
logCleaner
-
hfileCleaners
-
hfileCleanerPaths
-
exclusiveHFileCleanerPool
-
replicationBarrierCleaner
-
mobFileCleanerChore
-
mobFileCompactionChore
-
rollingUpgradeChore
-
mobCompactionLock
-
mobCompactionStates
-
cpHost
-
preLoadTableDescriptors
-
masterActiveTime
-
masterFinishedInitializationTime
-
coprocessorServiceHandlers
Map<String,org.apache.hbase.thirdparty.com.google.protobuf.Service> coprocessorServiceHandlers -
snapshotManager
-
mpmHost
-
regionsRecoveryChore
-
regionsRecoveryConfigManager
-
quotaManager
-
spaceQuotaSnapshotNotifier
-
quotaObserverChore
-
snapshotQuotaChore
-
oldWALsDirSizeChore
-
procedureExecutor
-
procedureStore
-
masterRegion
-
rsListStorage
-
tableStateManager
-
masterJettyServer
jetty server for master to redirect requests to regionserver infoServer -
maintenanceMode
-
MAINTENANCE_MODE
- See Also:
-
maintenanceRegionServer
-
cachedClusterId
-
WARMUP_BEFORE_MOVE
- See Also:
-
DEFAULT_WARMUP_BEFORE_MOVE
- See Also:
-
HBASE_MASTER_RSPROC_DISPATCHER_CLASS
Use RSProcedureDispatcher instance to initiate master -> rs remote procedure execution. Use this config to extend RSProcedureDispatcher (mainly for testing purpose).- See Also:
-
DEFAULT_HBASE_MASTER_RSPROC_DISPATCHER_CLASS
-
startupTaskGroup
-
replicationPeerModificationStateStore
Store whether we allow replication peer modification operations.
-
-
Constructor Details
-
HMaster
Initializes the HMaster. The steps are as follows:- Initialize the local HRegionServer
- Start the ActiveMasterManager.
Remaining steps of initialization occur in
finishActiveMasterInitialization()after the master becomes the active one.- Throws:
IOException
-
-
Method Details
-
createActiveMasterManager
protected ActiveMasterManager createActiveMasterManager(ZKWatcher zk, ServerName sn, Server server) throws InterruptedIOException Protected to have custom implementations in tests override the default ActiveMaster implementation.- Throws:
InterruptedIOException
-
getUseThisHostnameInstead
- Specified by:
getUseThisHostnameInsteadin classHBaseServerBase<MasterRpcServices>
-
registerConfigurationObservers
-
run
-
putUpJettyServer
- Throws:
IOException
-
login
For compatibility, if failed with regionserver credentials, try the master one- Specified by:
loginin classHBaseServerBase<MasterRpcServices>- Throws:
IOException
-
getMasterRpcServices
-
getCoprocessorHost
- Specified by:
getCoprocessorHostin classHBaseServerBase<MasterRpcServices>
-
balanceSwitch
- Throws:
IOException
-
getProcessName
- Specified by:
getProcessNamein classHBaseServerBase<MasterRpcServices>
-
canCreateBaseZNode
- Specified by:
canCreateBaseZNodein classHBaseServerBase<MasterRpcServices>
-
canUpdateTableDescriptor
- Specified by:
canUpdateTableDescriptorin classHBaseServerBase<MasterRpcServices>
-
cacheTableDescriptor
- Specified by:
cacheTableDescriptorin classHBaseServerBase<MasterRpcServices>
-
createRpcServices
- Specified by:
createRpcServicesin classHBaseServerBase<MasterRpcServices>- Throws:
IOException
-
configureInfoServer
- Specified by:
configureInfoServerin classHBaseServerBase<MasterRpcServices>
-
buildApiV1Servlet
-
buildHbckServlet
-
getDumpServlet
- Specified by:
getDumpServletin classHBaseServerBase<MasterRpcServices>
-
getMasterMetrics
Description copied from interface:MasterServicesReturns Master's instance ofMetricsMaster- Specified by:
getMasterMetricsin interfaceMasterServices
-
initializeZKBasedSystemTrackers
private void initializeZKBasedSystemTrackers() throws IOException, org.apache.zookeeper.KeeperException, ReplicationException, DeserializationExceptionInitialize all ZK based system trackers. But do not includeRegionServerTracker, it should have already been initialized along withServerManager.- Throws:
IOExceptionorg.apache.zookeeper.KeeperExceptionReplicationExceptionDeserializationException
-
createAssignmentManager
@Private protected AssignmentManager createAssignmentManager(MasterServices master, MasterRegion masterRegion) -
tryMigrateMetaLocationsFromZooKeeper
private void tryMigrateMetaLocationsFromZooKeeper() throws IOException, org.apache.zookeeper.KeeperException- Throws:
IOExceptionorg.apache.zookeeper.KeeperException
-
finishActiveMasterInitialization
private void finishActiveMasterInitialization() throws IOException, InterruptedException, org.apache.zookeeper.KeeperException, ReplicationException, DeserializationExceptionFinish initialization of HMaster after becoming the primary master. The startup order is a bit complicated but very important, do not change it unless you know what you are doing.- Initialize file system based components - file system manager, wal manager, table descriptors, etc
- Publish cluster id
- Here comes the most complicated part - initialize server manager, assignment manager and
region server tracker
- Create server manager
- Create master local region
- Create procedure executor, load the procedures, but do not start workers. We will start it later after we finish scheduling SCPs to avoid scheduling duplicated SCPs for the same server
- Create assignment manager and start it, load the meta region state, but do not load data from meta region
- Start region server tracker, construct the online servers set and find out dead servers and schedule SCP for them. The online servers will be constructed by scanning zk, and we will also scan the wal directory and load from master local region to find out possible live region servers, and the differences between these two sets are the dead servers
- If this is a new deploy, schedule a InitMetaProcedure to initialize meta
- Start necessary service threads - balancer, catalog janitor, executor services, and also the procedure executor, etc. Notice that the balancer must be created first as assignment manager may use it when assigning regions.
- Wait for meta to be initialized if necessary, start table state manager.
- Wait for enough region servers to check-in
- Let assignment manager load data from meta and construct region states
- Start all other things such as chore services, etc
- Throws:
IOExceptionInterruptedExceptionorg.apache.zookeeper.KeeperExceptionReplicationExceptionDeserializationException
-
setHbckChoreForTesting
Used for testing only to set Mock objects.- Parameters:
hbckChore- hbckChore
-
setCatalogJanitorChoreForTesting
Used for testing only to set Mock objects.- Parameters:
catalogJanitorChore- catalogJanitorChore
-
createMissingCFsInMetaDuringUpgrade
- Throws:
IOException
-
waitForMetaOnline
Check hbase:meta is up and ready for reading. For use during Master startup only.- Returns:
- True if meta is UP and online and startup can progress. Otherwise, meta is not online and we will hold here until operator intervention.
-
isRegionOnline
- Returns:
- True if region is online and scannable else false if an error or shutdown (Otherwise we just block in here holding up all forward-progess).
-
waitForNamespaceOnline
Check hbase:namespace table is assigned. If not, startup will hang looking for the ns table This is for rolling upgrading, later we will migrate the data in ns table to the ns family of meta table. And if this is a new cluster, this method will return immediately as there will be no namespace table/region.- Returns:
- True if namespace table is up/online.
- Throws:
IOException
-
updateConfigurationForQuotasObserver
@Private public void updateConfigurationForQuotasObserver(org.apache.hadoop.conf.Configuration conf) Adds theMasterQuotasObserverto the list of configured Master observers to automatically remove quotas for a table when that table is deleted. -
initMobCleaner
-
createServerManager
@Private protected ServerManager createServerManager(MasterServices master, RegionServerList storage) throws IOException Create a
ServerManagerinstance.Will be overridden in tests.
- Throws:
IOException
-
waitForRegionServers
- Throws:
IOExceptionInterruptedException
-
initClusterSchemaService
- Throws:
IOExceptionInterruptedException
-
initQuotaManager
- Throws:
IOException
-
createQuotaSnapshotNotifier
-
isCatalogJanitorEnabled
-
isCleanerChoreEnabled
boolean isCleanerChoreEnabled() -
getServerManager
Description copied from interface:MasterServicesReturns Master'sServerManagerinstance.- Specified by:
getServerManagerin interfaceMasterServices
-
getMasterFileSystem
Description copied from interface:MasterServicesReturns Master's filesystemMasterFileSystemutility class.- Specified by:
getMasterFileSystemin interfaceMasterServices
-
getMasterWalManager
Description copied from interface:MasterServicesReturns Master's WALsMasterWalManagerutility class.- Specified by:
getMasterWalManagerin interfaceMasterServices
-
getSplitWALManager
Description copied from interface:MasterServicesReturns return null if current is zk-based WAL splitting- Specified by:
getSplitWALManagerin interfaceMasterServices
-
getTableStateManager
Description copied from interface:MasterServicesReturns Master's instance ofTableStateManager- Specified by:
getTableStateManagerin interfaceMasterServices
-
startServiceThreads
- Throws:
IOException
-
stopServiceThreads
-
createProcedureExecutor
- Throws:
IOException
-
startProcedureExecutor
- Throws:
IOException
-
switchSnapshotCleanup
Turn on/off Snapshot Cleanup Chore- Parameters:
on- indicates whether Snapshot Cleanup Chore is to be run- Throws:
IOException
-
switchSnapshotCleanup
- Throws:
IOException
-
stopProcedureExecutor
-
stopChores
- Specified by:
stopChoresin classHBaseServerBase<MasterRpcServices>
-
getRemoteInetAddress
Returns Get remote side's InetAddress- Throws:
UnknownHostException
-
getMaxBalancingTime
Returns Maximum time we should run balancer for -
getMaxRegionsInTransition
Returns Maximum number of regions in transition -
balanceThrottling
private void balanceThrottling(long nextBalanceStartTime, int maxRegionsInTransition, long cutoffTime) It first sleep to the next balance plan start time. Meanwhile, throttling by the max number regions in transition to protect availability.- Parameters:
nextBalanceStartTime- The next balance plan start timemaxRegionsInTransition- max number of regions in transitioncutoffTime- when to exit balancer
-
balance
- Throws:
IOException
-
balanceOrUpdateMetrics
Trigger a normal balance, seebalance(). If the balance is not executed this time, the metrics related to the balance will be updated. When balance is running, related metrics will be updated at the same time. But if some checking logic failed and cause the balancer exit early, we lost the chance to update balancer metrics. This will lead to user missing the latest balancer info.- Throws:
IOException
-
skipRegionManagementAction
Checks master state before initiating action over region topology.- Specified by:
skipRegionManagementActionin interfaceMasterServices- Parameters:
action- the name of the action under consideration, for logging.- Returns:
truewhen the caller should exit early,falseotherwise.
-
balance
- Throws:
IOException
-
executeRegionPlansWithThrottling
Execute region plans with throttling- Specified by:
executeRegionPlansWithThrottlingin interfaceMasterServices- Parameters:
plans- to execute- Returns:
- succeeded plans
-
getRegionNormalizerManager
Description copied from interface:MasterServicesReturns Master's instance ofRegionNormalizerManager- Specified by:
getRegionNormalizerManagerin interfaceMasterServices
-
normalizeRegions
public boolean normalizeRegions(NormalizeTableFilterParams ntfp, boolean isHighPriority) throws IOException Description copied from interface:MasterServicesPerform normalization of cluster.- Specified by:
normalizeRegionsin interfaceMasterServices- 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
-
getClientIdAuditPrefix
Returns Client info for use as prefix on an audit log string; who did an action- Specified by:
getClientIdAuditPrefixin interfaceMasterServices
-
setCatalogJanitorEnabled
Switch for the background CatalogJanitor thread. Used for testing. The thread will continue to run. It will just be a noop if disabled.- Parameters:
b- If false, the catalog janitor won't do anything.
-
mergeRegions
public long mergeRegions(RegionInfo[] regionsToMerge, boolean forcible, long ng, long nonce) throws IOException Description copied from interface:MasterServicesMerge regions in a table.- Specified by:
mergeRegionsin interfaceMasterServices- Parameters:
regionsToMerge- daughter regions to mergeforcible- whether to force to merge even two regions are not adjacentng- used to detect duplicatenonce- used to detect duplicate- Returns:
- procedure Id
- Throws:
IOException
-
splitRegion
public long splitRegion(RegionInfo regionInfo, byte[] splitRow, long nonceGroup, long nonce) throws IOException Description copied from interface:MasterServicesSplit a region.- Specified by:
splitRegionin interfaceMasterServices- Parameters:
regionInfo- region to splitsplitRow- split pointnonceGroup- used to detect duplicatenonce- used to detect duplicate- Returns:
- procedure Id
- Throws:
IOException
-
warmUpRegion
-
move
- Throws:
IOException
-
createTable
public long createTable(TableDescriptor tableDescriptor, byte[][] splitKeys, long nonceGroup, long nonce) throws IOException Description copied from interface:MasterServicesCreate a table using the given table definition.- Specified by:
createTablein interfaceMasterServices- Parameters:
tableDescriptor- The table definitionsplitKeys- Starting row keys for the initial table regions. If null a single region is created.- Throws:
IOException
-
createSystemTable
Description copied from interface:MasterServicesCreate a system table using the given table definition.- Specified by:
createSystemTablein interfaceMasterServices- Parameters:
tableDescriptor- The system table definition a single region is created.- Throws:
IOException
-
startActiveMasterManager
- Throws:
org.apache.zookeeper.KeeperException
-
isCatalogTable
-
deleteTable
Description copied from interface:MasterServicesDelete a table- Specified by:
deleteTablein interfaceMasterServices- Parameters:
tableName- The table name- Throws:
IOException
-
truncateTable
public long truncateTable(TableName tableName, boolean preserveSplits, long nonceGroup, long nonce) throws IOException Description copied from interface:MasterServicesTruncate a table- Specified by:
truncateTablein interfaceMasterServices- Parameters:
tableName- The table namepreserveSplits- True if the splits should be preserved- Throws:
IOException
-
truncateRegion
Description copied from interface:MasterServicesTruncate region- Specified by:
truncateRegionin interfaceMasterServices- Parameters:
regionInfo- region to be truncatednonceGroup- the nonce groupnonce- the nonce- Returns:
- procedure Id
- Throws:
IOException
-
addColumn
public long addColumn(TableName tableName, ColumnFamilyDescriptor column, long nonceGroup, long nonce) throws IOException Description copied from interface:MasterServicesAdd a new column to an existing table- Specified by:
addColumnin interfaceMasterServices- Parameters:
tableName- The table namecolumn- The column definition- Throws:
IOException
-
modifyColumn
public long modifyColumn(TableName tableName, ColumnFamilyDescriptor descriptor, long nonceGroup, long nonce) throws IOException Description copied from interface:MasterServicesModify the column descriptor of an existing column in an existing table- Specified by:
modifyColumnin interfaceMasterServices- Parameters:
tableName- The table namedescriptor- The updated column definition- Throws:
IOException
-
modifyColumnStoreFileTracker
public long modifyColumnStoreFileTracker(TableName tableName, byte[] family, String dstSFT, long nonceGroup, long nonce) throws IOException Description copied from interface:MasterServicesModify the store file tracker of an existing column in an existing table- Specified by:
modifyColumnStoreFileTrackerin interfaceMasterServices- Throws:
IOException
-
deleteColumn
public long deleteColumn(TableName tableName, byte[] columnName, long nonceGroup, long nonce) throws IOException Description copied from interface:MasterServicesDelete a column from an existing table- Specified by:
deleteColumnin interfaceMasterServices- Parameters:
tableName- The table namecolumnName- The column name- Throws:
IOException
-
enableTable
Description copied from interface:MasterServicesEnable an existing table- Specified by:
enableTablein interfaceMasterServices- Parameters:
tableName- The table name- Throws:
IOException
-
disableTable
Description copied from interface:MasterServicesDisable an existing table- Specified by:
disableTablein interfaceMasterServices- Parameters:
tableName- The table name- Throws:
IOException
-
modifyTable
private long modifyTable(TableName tableName, HMaster.TableDescriptorGetter newDescriptorGetter, long nonceGroup, long nonce, boolean shouldCheckDescriptor) throws IOException - Throws:
IOException
-
modifyTable
private long modifyTable(TableName tableName, HMaster.TableDescriptorGetter newDescriptorGetter, long nonceGroup, long nonce, boolean shouldCheckDescriptor, boolean reopenRegions) throws IOException - Throws:
IOException
-
modifyTable
public long modifyTable(TableName tableName, TableDescriptor newDescriptor, long nonceGroup, long nonce, boolean reopenRegions) throws IOException Description copied from interface:MasterServicesModify the descriptor of an existing table- Specified by:
modifyTablein interfaceMasterServices- Parameters:
tableName- The table namenewDescriptor- The updated table descriptorreopenRegions- Whether to reopen regions after modifying the table descriptor- Throws:
IOException
-
modifyTableStoreFileTracker
public long modifyTableStoreFileTracker(TableName tableName, String dstSFT, long nonceGroup, long nonce) throws IOException Description copied from interface:MasterServicesModify the store file tracker of an existing table- Specified by:
modifyTableStoreFileTrackerin interfaceMasterServices- Throws:
IOException
-
restoreSnapshot
public long restoreSnapshot(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDesc, long nonceGroup, long nonce, boolean restoreAcl, String customSFT) throws IOException - Throws:
IOException
-
checkTableExists
- Throws:
IOExceptionTableNotFoundException
-
checkTableModifiable
public void checkTableModifiable(TableName tableName) throws IOException, TableNotFoundException, TableNotDisabledException Description copied from interface:MasterServicesCheck table is modifiable; i.e. exists and is offline.- Specified by:
checkTableModifiablein interfaceMasterServices- Parameters:
tableName- Name of table to check.- Throws:
IOExceptionTableNotFoundExceptionTableNotDisabledException
-
reloadRegionServerQuotas
-
getClusterMetricsWithoutCoprocessor
- Throws:
InterruptedIOException
-
getClusterMetricsWithoutCoprocessor
public ClusterMetrics getClusterMetricsWithoutCoprocessor(EnumSet<ClusterMetrics.Option> options) throws InterruptedIOException - Throws:
InterruptedIOException
-
getUnknownServers
-
getOnlineServers
-
getClusterMetrics
Returns cluster status- Throws:
IOException
-
getClusterMetrics
- Throws:
IOException
-
getActiveMasterInfoPort
Returns info port of active master or 0 if any exception occurs. -
getBackupMasterInfoPort
- Parameters:
sn- is ServerName of the backup master- Returns:
- info port of backup master or 0 if any exception occurs.
-
getLoadedCoprocessors
The set of loaded coprocessors is stored in a static set. Since it's statically allocated, it does not require that HMaster's cpHost be initialized prior to accessing it.- Returns:
- a String representation of the set of names of the loaded coprocessors.
-
getMasterStartTime
Returns timestamp in millis when HMaster was started. -
getMasterActiveTime
Returns timestamp in millis when HMaster became the active master.- Specified by:
getMasterActiveTimein interfaceMasterServices
-
getMasterFinishedInitializationTime
Returns timestamp in millis when HMaster finished becoming the active master -
getNumWALFiles
-
getProcedureStore
-
getRegionServerInfoPort
-
getRegionServerVersion
- Specified by:
getRegionServerVersionin interfaceMasterServices
-
checkIfShouldMoveSystemRegionAsync
Description copied from interface:MasterServicesCalled 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.- Specified by:
checkIfShouldMoveSystemRegionAsyncin interfaceMasterServices
-
getMasterCoprocessors
Returns array of coprocessor SimpleNames. -
abort
Description copied from interface:AbortableAbort the server or client. -
getMasterCoprocessorHost
Description copied from interface:MasterServicesReturns Master's instance ofMasterCoprocessorHost- Specified by:
getMasterCoprocessorHostin interfaceMasterServices
-
getMasterQuotaManager
Description copied from interface:MasterServicesReturns Master's instance ofMasterQuotaManager- Specified by:
getMasterQuotaManagerin interfaceMasterServices
-
getMasterProcedureExecutor
Description copied from interface:MasterServicesReturns Master's instance ofProcedureExecutor- Specified by:
getMasterProcedureExecutorin interfaceMasterServices
-
getServerName
Description copied from interface:ServerReturns The unique server name for this server.- Specified by:
getServerNamein interfaceServer- Overrides:
getServerNamein classHBaseServerBase<MasterRpcServices>
-
getAssignmentManager
Description copied from interface:MasterServicesReturns Master's instance of theAssignmentManager- Specified by:
getAssignmentManagerin interfaceMasterServices
-
getCatalogJanitor
Description copied from interface:MasterServicesReturns Master's instance ofCatalogJanitor- Specified by:
getCatalogJanitorin interfaceMasterServices
-
getRegionServerFatalLogBuffer
-
getStartupProgress
-
shutdown
Shutdown the cluster. Master runs a coordinated stop of all RegionServers and then itself.- Throws:
IOException
-
stopMaster
- Throws:
IOException
-
stop
Description copied from interface:StoppableStop this service. Implementers should favor logging errors over throwing RuntimeExceptions. -
checkServiceStarted
- Throws:
ServerNotRunningYetException
-
checkInitialized
-
isActiveMaster
Report whether this master is currently the active master or not. If not active master, we are parked on ZK waiting to become active. This method is used for testing.- Specified by:
isActiveMasterin interfaceMasterServices- Returns:
- true if active master, false if not.
-
isInitialized
Report whether this master has completed with its initialization and is ready. If ready, the master is also the active master. A standby master is never ready. This method is used for testing.- Specified by:
isInitializedin interfaceMasterServices- Returns:
- true if master is ready to go, false if not.
-
isOnline
Report whether this master is started This method is used for testing.- Returns:
- true if master is ready to go, false if not.
-
isInMaintenanceMode
Report whether this master is in maintenance mode.- Specified by:
isInMaintenanceModein interfaceMasterServices- Returns:
- true if master is in maintenanceMode
-
setInitialized
-
setServiceStarted
Mainly used in procedure related tests, where we will restart ProcedureExecutor and AssignmentManager, but we do not want to restart master(to speed up the test), so we need to disable rpc for a while otherwise some critical rpc requests such as reportRegionStateTransition could fail and cause region server to abort. -
getInitializedEvent
Description copied from interface:MasterServicesReturns Tripped when Master has finished initialization.- Specified by:
getInitializedEventin interfaceMasterServices
-
getAverageLoad
Compute the average load across all region servers. Currently, this uses a very naive computation - just uses the number of regions being served, ignoring stats about number of requests.- Returns:
- the average load
-
registerService
Description copied from interface:MasterServicesRegisters 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.- Specified by:
registerServicein interfaceMasterServices- Parameters:
instance- theServicesubclass instance to expose as a coprocessor endpoint- Returns:
trueif the registration was successful,falseotherwise
-
constructMaster
public static HMaster constructMaster(Class<? extends HMaster> masterClass, org.apache.hadoop.conf.Configuration conf) Utility for constructing an instance of the passed HMaster class.- Returns:
- HMaster instance.
-
main
- See Also:
-
getHFileCleaner
-
getHFileCleaners
-
getLogCleaner
-
getSnapshotManager
Returns the underlying snapshot manager- Specified by:
getSnapshotManagerin interfaceMasterServices
-
getMasterProcedureManagerHost
Returns the underlying MasterProcedureManagerHost- Specified by:
getMasterProcedureManagerHostin interfaceMasterServices
-
getClusterSchema
Description copied from interface:MasterServicesReturns Master's instance ofClusterSchema- Specified by:
getClusterSchemain interfaceMasterServices
-
createNamespace
long createNamespace(NamespaceDescriptor namespaceDescriptor, long nonceGroup, long nonce) throws IOException Create a new Namespace.- Parameters:
namespaceDescriptor- descriptor for new NamespacenonceGroup- Identifier for the source of the request, a client or process.nonce- A unique identifier for this operation from the client or process identified bynonceGroup(the source must ensure each operation gets a unique id).- Returns:
- procedure id
- Throws:
IOException
-
modifyNamespace
long modifyNamespace(NamespaceDescriptor newNsDescriptor, long nonceGroup, long nonce) throws IOException Modify an existing Namespace.- Parameters:
nonceGroup- Identifier for the source of the request, a client or process.nonce- A unique identifier for this operation from the client or process identified bynonceGroup(the source must ensure each operation gets a unique id).- Returns:
- procedure id
- Throws:
IOException
-
deleteNamespace
Delete an existing Namespace. Only empty Namespaces (no tables) can be removed.- Parameters:
nonceGroup- Identifier for the source of the request, a client or process.nonce- A unique identifier for this operation from the client or process identified bynonceGroup(the source must ensure each operation gets a unique id).- Returns:
- procedure id
- Throws:
IOException
-
getNamespace
Get a Namespace- Parameters:
name- Name of the Namespace- Returns:
- Namespace descriptor for
name - Throws:
IOException
-
getNamespaces
Get all Namespaces- Returns:
- All Namespace descriptors
- Throws:
IOException
-
listNamespaces
List namespace names- Returns:
- All namespace names
- Throws:
IOException
-
listTableNamesByNamespace
Description copied from interface:MasterServicesGet list of table names by namespace- Specified by:
listTableNamesByNamespacein interfaceMasterServices- Parameters:
name- namespace name- Returns:
- table names
- Throws:
IOException
-
listTableDescriptorsByNamespace
Description copied from interface:MasterServicesGet list of table descriptors by namespace- Specified by:
listTableDescriptorsByNamespacein interfaceMasterServices- Parameters:
name- namespace name- Throws:
IOException
-
abortProcedure
Description copied from interface:MasterServicesAbort a procedure.- Specified by:
abortProcedurein interfaceMasterServices- 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
Description copied from interface:MasterServicesGet procedures- Specified by:
getProceduresin interfaceMasterServices- Returns:
- procedure list
- Throws:
IOException
-
getLocks
Description copied from interface:MasterServicesGet locks- Specified by:
getLocksin interfaceMasterServices- Returns:
- lock list
- Throws:
IOException
-
listTableDescriptors
public List<TableDescriptor> listTableDescriptors(String namespace, String regex, List<TableName> tableNameList, boolean includeSysTables) throws IOException Returns the list of table descriptors that match the specified request- Parameters:
namespace- the namespace to query, or null if querying for allregex- The regular expression to match against, or null if querying for alltableNameList- the list of table names, or null if querying for allincludeSysTables- False to match only against userspace tables- Returns:
- the list of table descriptors
- Throws:
IOException
-
listTableNames
public List<TableName> listTableNames(String namespace, String regex, boolean includeSysTables) throws IOException Returns the list of table names that match the specified request- Parameters:
regex- The regular expression to match against, or null if querying for allnamespace- the namespace to query, or null if querying for allincludeSysTables- False to match only against userspace tables- Returns:
- the list of table names
- Throws:
IOException
-
getTableDescriptors
private List<TableDescriptor> getTableDescriptors(List<TableDescriptor> htds, String namespace, String regex, List<TableName> tableNameList, boolean includeSysTables) throws IOException Return a list of table table descriptors after applying any provided filter parameters. Note that the user-facing description of this filter logic is presented on the class-level javadoc ofNormalizeTableFilterParams.- Throws:
IOException
-
filterTablesByRegex
Removes the table descriptors that don't match the pattern.- Parameters:
descriptors- list of table descriptors to filterpattern- the regex to use
-
getLastMajorCompactionTimestamp
- Specified by:
getLastMajorCompactionTimestampin interfaceMasterServices- 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
Description copied from interface:MasterServicesReturns the timestamp of the last successful major compaction for the passed region or 0 if no HFile resulting from a major compaction exists- Specified by:
getLastMajorCompactionTimestampForRegionin interfaceMasterServices- Throws:
IOException
-
getMobCompactionState
public org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionState getMobCompactionState(TableName tableName) Gets the mob file compaction state for a specific table. Whether all the mob files are selected is known during the compaction execution, but the statistic is done just before compaction starts, it is hard to know the compaction type at that time, so the rough statistics are chosen for the mob file compaction. Only two compaction states are available, CompactionState.MAJOR_AND_MINOR and CompactionState.NONE.- Parameters:
tableName- The current table name.- Returns:
- If a given table is in mob file compaction now.
-
reportMobCompactionStart
- Throws:
IOException
-
reportMobCompactionEnd
- Throws:
IOException
-
isBalancerOn
Queries the state of theLoadBalancerStateStore. If the balancer is not initialized, false is returned.- Specified by:
isBalancerOnin interfaceMasterServices- Returns:
- The state of the load balancer, or false if the load balancer isn't defined.
-
isNormalizerOn
Queries the state of theRegionNormalizerStateStore. If it's not initialized, false is returned. -
isSplitOrMergeEnabled
Queries the state of theSplitOrMergeStateStore. If it is not initialized, false is returned. If switchType is illegal, false will return.- Specified by:
isSplitOrMergeEnabledin interfaceMasterServices- Parameters:
switchType- seeMasterSwitchType- Returns:
- The state of the switch
-
getLoadBalancerClassName
Fetch the configuredLoadBalancerclass name. If none is set, a default is returned. Notice that, the base load balancer will always beRSGroupBasedLoadBalancernow, so this method will return the balancer used inside each rs group.- Returns:
- The name of the
LoadBalancerin use.
-
getSplitOrMergeStateStore
-
getLoadBalancer
Description copied from interface:MasterServicesReturns load balancer- Specified by:
getLoadBalancerin interfaceMasterServices
-
getFavoredNodesManager
Description copied from interface:MasterServicesReturns Favored Nodes Manager- Specified by:
getFavoredNodesManagerin interfaceMasterServices
-
executePeerProcedure
- Throws:
IOException
-
addReplicationPeer
public long addReplicationPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled) throws ReplicationException, IOException Description copied from interface:MasterServicesAdd a new replication peer for replicating data to slave cluster- Specified by:
addReplicationPeerin interfaceMasterServices- 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
Description copied from interface:MasterServicesRemoves a peer and stops the replication- Specified by:
removeReplicationPeerin interfaceMasterServices- Parameters:
peerId- a short name that identifies the peer- Throws:
ReplicationExceptionIOException
-
enableReplicationPeer
Description copied from interface:MasterServicesRestart the replication stream to the specified peer- Specified by:
enableReplicationPeerin interfaceMasterServices- Parameters:
peerId- a short name that identifies the peer- Throws:
ReplicationExceptionIOException
-
disableReplicationPeer
Description copied from interface:MasterServicesStop the replication stream to the specified peer- Specified by:
disableReplicationPeerin interfaceMasterServices- Parameters:
peerId- a short name that identifies the peer- Throws:
ReplicationExceptionIOException
-
getReplicationPeerConfig
public ReplicationPeerConfig getReplicationPeerConfig(String peerId) throws ReplicationException, IOException Description copied from interface:MasterServicesReturns the configured ReplicationPeerConfig for the specified peer- Specified by:
getReplicationPeerConfigin interfaceMasterServices- Parameters:
peerId- a short name that identifies the peer- Returns:
- ReplicationPeerConfig for the peer
- Throws:
ReplicationExceptionIOException
-
updateReplicationPeerConfig
public long updateReplicationPeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws ReplicationException, IOException Description copied from interface:MasterServicesUpdate the peerConfig for the specified peer- Specified by:
updateReplicationPeerConfigin interfaceMasterServices- Parameters:
peerId- a short name that identifies the peerpeerConfig- new config for the peer- Throws:
ReplicationExceptionIOException
-
listReplicationPeers
public List<ReplicationPeerDescription> listReplicationPeers(String regex) throws ReplicationException, IOException Description copied from interface:MasterServicesReturn a list of replication peers.- Specified by:
listReplicationPeersin interfaceMasterServices- Parameters:
regex- The regular expression to match peer id- Returns:
- a list of replication peers description
- Throws:
ReplicationExceptionIOException
-
transitReplicationPeerSyncReplicationState
public long transitReplicationPeerSyncReplicationState(String peerId, SyncReplicationState state) throws ReplicationException, IOException Description copied from interface:MasterServicesSet current cluster state for a synchronous replication peer.- Specified by:
transitReplicationPeerSyncReplicationStatein interfaceMasterServices- Parameters:
peerId- a short name that identifies the peerstate- state of current cluster- Throws:
ReplicationExceptionIOException
-
replicationPeerModificationSwitch
- Specified by:
replicationPeerModificationSwitchin interfaceMasterServices- Throws:
IOException
-
isReplicationPeerModificationEnabled
- Specified by:
isReplicationPeerModificationEnabledin interfaceMasterServices
-
decommissionRegionServers
Mark region server(s) as decommissioned (previously called 'draining') to prevent additional regions from getting assigned to them. Also unload the regions on the servers asynchronously.0- Parameters:
servers- Region servers to decommission.- Throws:
IOException
-
listDecommissionedRegionServers
List region servers marked as decommissioned (previously called 'draining') to not get regions assigned to them.- Returns:
- List of decommissioned servers.
-
recommissionRegionServer
public void recommissionRegionServer(ServerName server, List<byte[]> encodedRegionNames) throws IOException Remove decommission marker (previously called 'draining') from a region server to allow regions assignments. Load regions onto the server asynchronously if a list of regions is given- Parameters:
server- Region server to remove decommission marker from.- Throws:
IOException
-
getLockManager
Description copied from interface:MasterServicesReturnsLockManagerto lock namespaces/tables/regions.- Specified by:
getLockManagerin interfaceMasterServices
-
getQuotaObserverChore
-
getSpaceQuotaSnapshotNotifier
-
getRemoteProcedure
private RemoteProcedureDispatcher.RemoteProcedure<MasterProcedureEnv,?> getRemoteProcedure(long procId) -
remoteProcedureCompleted
-
remoteProcedureFailed
-
reopenRegions
long reopenRegions(TableName tableName, List<byte[]> regionNames, long nonceGroup, long nonce) throws IOException Reopen regions provided in the argument- Parameters:
tableName- The current table nameregionNames- The region names of the regions to reopennonceGroup- Identifier for the source of the request, a client or processnonce- A unique identifier for this operation from the client or process identified bynonceGroup(the source must ensure each operation gets a unique id).- Returns:
- procedure Id
- Throws:
IOException- if reopening region fails while running procedure
-
getReplicationPeerManager
Description copied from interface:MasterServicesReturns theReplicationPeerManager.- Specified by:
getReplicationPeerManagerin interfaceMasterServices
-
getReplicationLogCleanerBarrier
Description copied from interface:MasterServicesReturns theReplicationLogCleanerBarrier. It will be used at multiple places so we put it in MasterServices directly.- Specified by:
getReplicationLogCleanerBarrierin interfaceMasterServices
-
getSyncReplicationPeerLock
Description copied from interface:MasterServicesReturns the SyncReplicationPeerLock.- Specified by:
getSyncReplicationPeerLockin interfaceMasterServices
-
getReplicationLoad
public HashMap<String,List<Pair<ServerName, getReplicationLoadReplicationLoadSource>>> (ServerName[] serverNames) -
decorateMasterConfiguration
This method modifies the master's configuration in order to inject replication-related features -
getSnapshotQuotaObserverChore
-
getActiveMasterManager
-
getSyncReplicationReplayWALManager
Description copied from interface:MasterServicesReturns theSyncReplicationReplayWALManager.- Specified by:
getSyncReplicationReplayWALManagerin interfaceMasterServices
-
getHbckChore
Description copied from interface:MasterServicesReturns Master's instance ofHbckChore- Specified by:
getHbckChorein interfaceMasterServices
-
runReplicationBarrierCleaner
Description copied from interface:MasterServicesRun the ReplicationBarrierChore.- Specified by:
runReplicationBarrierCleanerin interfaceMasterServices
-
getRSGroupInfoManager
Description copied from interface:MasterServicesReturns theRSGroupInfoManager- Specified by:
getRSGroupInfoManagerin interfaceMasterServices
-
getCompactionState
Get the compaction state of the table- Parameters:
tableName- The table name- Returns:
- CompactionState Compaction state of the table
-
getMetaLocationSyncer
Description copied from interface:MasterServicesGet the meta location syncer. We need to get this in MTP to tell the syncer the new meta replica count.- Specified by:
getMetaLocationSyncerin interfaceMasterServices
-
getMasterRegion
-
onConfigurationChange
Description copied from interface:ConfigurationObserverThis method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.- Specified by:
onConfigurationChangein interfaceConfigurationObserver
-
createNamedQueueRecord
- Specified by:
createNamedQueueRecordin classHBaseServerBase<MasterRpcServices>
-
clusterMode
- Specified by:
clusterModein classHBaseServerBase<MasterRpcServices>
-
getClusterId
Description copied from interface:ConnectionRegistryEndpointGet cluster id.- Specified by:
getClusterIdin interfaceConnectionRegistryEndpoint
-
getActiveMaster
Description copied from interface:ConnectionRegistryEndpointGet active master address.- Specified by:
getActiveMasterin interfaceConnectionRegistryEndpoint
-
getBackupMasters
Description copied from interface:ConnectionRegistryEndpointGet backup masters address.- Specified by:
getBackupMastersin interfaceConnectionRegistryEndpoint
-
getBootstrapNodes
Description copied from interface:ConnectionRegistryEndpointGet a iterator of the available bootstrap nodes.- Specified by:
getBootstrapNodesin interfaceConnectionRegistryEndpoint
-
getMetaLocations
Description copied from interface:ConnectionRegistryEndpointGet the location of meta regions.- Specified by:
getMetaLocationsin interfaceConnectionRegistryEndpoint
-
flushMasterStore
Description copied from interface:MasterServicesFlush master local region- Specified by:
flushMasterStorein interfaceMasterServices- Throws:
IOException
-
getLiveRegionServers
-
setLoadBalancer
-
setAssignmentManager
-
setDisableBalancerChoreForTest
-
setQuotasObserver
-
initializeCoprocessorHost
-
flushTable
public long flushTable(TableName tableName, List<byte[]> columnFamilies, long nonceGroup, long nonce) throws IOException Description copied from interface:MasterServicesFlush an existing table- Specified by:
flushTablein interfaceMasterServices- Parameters:
tableName- The table namecolumnFamilies- The column families to flushnonceGroup- the nonce groupnonce- the nonce- Returns:
- the flush procedure id
- Throws:
IOException
-
rollAllWALWriters
Description copied from interface:MasterServicesRoll WAL writer for all RegionServers- Specified by:
rollAllWALWritersin interfaceMasterServices- Returns:
- procedure id
- Throws:
IOException
-