@InterfaceAudience.LimitedPrivate(value="Tools") public class HMaster extends HRegionServer implements MasterServices
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()
.
Watcher
Modifier and Type | Class and Description |
---|---|
private static class |
HMaster.InitializationMonitor
Protection against zombie master.
|
static class |
HMaster.MasterStoppedException |
static class |
HMaster.RedirectServlet |
protected static interface |
HMaster.TableDescriptorGetter
Implement to return TableDescriptor after pre-checks
|
HRegionServer.MovedRegionsCleaner
RegionServerServices.PostOpenDeployContext, RegionServerServices.RegionStateTransitionContext
ABORT_TIMEOUT, ABORT_TIMEOUT_TASK, cacheConfig, cacheFlusher, clusterConnection, clusterId, clusterStatusTracker, compactSplitThread, conf, configurationManager, csm, executorService, fs, fsOk, fsUtilizationChore, hMemManager, infoServer, leases, lock, MASTER_HOSTNAME_KEY, metaTableLocator, movedRegions, msgInterval, numRegionsToReport, onlineRegions, regionFavoredNodesMap, REGIONSERVER, regionsInTransitionInRS, replicationSinkHandler, replicationSourceHandler, rpcServices, secureBulkLoadManager, serverName, sleeper, startcode, tableDescriptors, TEST_SKIP_REPORTING_TRANSITION, threadWakeFrequency, useThisHostnameInstead, walFactory, walFs, walRoller, zooKeeper
Constructor and Description |
---|
HMaster(org.apache.hadoop.conf.Configuration conf)
Initializes the HMaster.
|
Modifier and Type | Method and Description |
---|---|
void |
abort(String reason,
Throwable cause)
Cause the server to exit without closing the regions it is serving, the log
it is using and without notifying the master.
|
boolean |
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 table
|
void |
addReplicationPeer(String peerId,
ReplicationPeerConfig peerConfig,
boolean enabled)
Add a new replication peer for replicating data to slave cluster
|
boolean |
balance() |
boolean |
balance(boolean force) |
boolean |
balanceSwitch(boolean b) |
private void |
balanceThrottling(long nextBalanceStartTime,
int maxRegionsInTransition,
long cutoffTime)
It first sleep to the next balance plan start time.
|
protected boolean |
canCreateBaseZNode() |
protected boolean |
canUpdateTableDescriptor() |
private void |
checkClassLoading(org.apache.hadoop.conf.Configuration conf,
TableDescriptor htd) |
private void |
checkCompactionPolicy(org.apache.hadoop.conf.Configuration conf,
TableDescriptor htd) |
private void |
checkCompression(ColumnFamilyDescriptor hcd) |
private void |
checkCompression(TableDescriptor htd) |
private void |
checkEncryption(org.apache.hadoop.conf.Configuration conf,
ColumnFamilyDescriptor hcd) |
private void |
checkEncryption(org.apache.hadoop.conf.Configuration conf,
TableDescriptor htd) |
void |
checkIfShouldMoveSystemRegionAsync()
Called when a new RegionServer is added to the cluster.
|
(package private) void |
checkInitialized() |
private void |
checkReplicationScope(ColumnFamilyDescriptor hcd) |
(package private) void |
checkServiceStarted() |
private void |
checkTableExists(TableName tableName) |
void |
checkTableModifiable(TableName tableName)
Check table is modifiable; i.e.
|
protected void |
configureInfoServer() |
static HMaster |
constructMaster(Class<? extends HMaster> masterClass,
org.apache.hadoop.conf.Configuration conf)
Utility for constructing an instance of the passed HMaster class.
|
protected MasterMetaBootstrap |
createMetaBootstrap()
Create a
MasterMetaBootstrap instance. |
(package private) long |
createNamespace(NamespaceDescriptor namespaceDescriptor,
long nonceGroup,
long nonce)
Create a new Namespace.
|
private void |
createProcedureExecutor() |
private SpaceQuotaSnapshotNotifier |
createQuotaSnapshotNotifier() |
protected RSRpcServices |
createRpcServices() |
protected ServerManager |
createServerManager(MasterServices master)
Create a
ServerManager instance. |
long |
createSystemTable(TableDescriptor tableDescriptor)
Create a system table using the given table definition.
|
long |
createTable(TableDescriptor tableDescriptor,
byte[][] splitKeys,
long nonceGroup,
long nonce)
Create a table using the given table definition.
|
void |
decommissionRegionServers(List<ServerName> servers,
boolean offload)
Mark region server(s) as decommissioned (previously called 'draining') to prevent additional
regions from getting assigned to them.
|
static void |
decorateMasterConfiguration(org.apache.hadoop.conf.Configuration conf)
This method modifies the master's configuration in order to inject replication-related features
|
long |
deleteColumn(TableName tableName,
byte[] columnName,
long nonceGroup,
long nonce)
Delete a column from an existing table
|
(package private) long |
deleteNamespace(String name,
long nonceGroup,
long nonce)
Delete an existing Namespace.
|
long |
deleteTable(TableName tableName,
long nonceGroup,
long nonce)
Delete a table
|
void |
disableReplicationPeer(String peerId)
Stop the replication stream to the specified peer
|
long |
disableTable(TableName tableName,
long nonceGroup,
long nonce)
Disable an existing table
|
void |
enableReplicationPeer(String peerId)
Restart the replication stream to the specified peer
|
long |
enableTable(TableName tableName,
long nonceGroup,
long nonce)
Enable an existing table
|
private static void |
filterTablesByRegex(Collection<TableDescriptor> descriptors,
Pattern pattern)
Removes the table descriptors that don't match the pattern.
|
private void |
finishActiveMasterInitialization(MonitoredTask status)
Finish initialization of HMaster after becoming the primary master.
|
AssignmentManager |
getAssignmentManager() |
double |
getAverageLoad()
Compute the average load across all region servers.
|
private List<ServerName> |
getBackupMasters() |
CatalogJanitor |
getCatalogJanitor() |
String |
getClientIdAuditPrefix() |
ClusterMetrics |
getClusterMetrics() |
ClusterMetrics |
getClusterMetrics(EnumSet<ClusterMetrics.Option> options) |
ClusterMetrics |
getClusterMetricsWithoutCoprocessor() |
ClusterMetrics |
getClusterMetricsWithoutCoprocessor(EnumSet<ClusterMetrics.Option> options) |
ClusterSchema |
getClusterSchema() |
protected Class<? extends javax.servlet.http.HttpServlet> |
getDumpServlet() |
FavoredNodesManager |
getFavoredNodesManager() |
HbckChore |
getHbckChore() |
HFileCleaner |
getHFileCleaner() |
ProcedureEvent |
getInitializedEvent() |
long |
getLastMajorCompactionTimestamp(TableName table) |
long |
getLastMajorCompactionTimestampForRegion(byte[] regionName) |
LoadBalancer |
getLoadBalancer() |
String |
getLoadBalancerClassName()
Fetch the configured
LoadBalancer class name. |
static String |
getLoadedCoprocessors()
The set of loaded coprocessors is stored in a static set.
|
LockManager |
getLockManager() |
List<LockedResource> |
getLocks()
Get locks
|
LogCleaner |
getLogCleaner() |
long |
getMasterActiveTime() |
MasterCoprocessorHost |
getMasterCoprocessorHost() |
String[] |
getMasterCoprocessors() |
MasterFileSystem |
getMasterFileSystem() |
long |
getMasterFinishedInitializationTime() |
MetricsMaster |
getMasterMetrics() |
ProcedureExecutor<MasterProcedureEnv> |
getMasterProcedureExecutor() |
MasterProcedureManagerHost |
getMasterProcedureManagerHost() |
MasterQuotaManager |
getMasterQuotaManager() |
MasterRpcServices |
getMasterRpcServices() |
long |
getMasterStartTime() |
MasterWalManager |
getMasterWalManager() |
private int |
getMaxBalancingTime() |
private int |
getMaxRegionsInTransition() |
long |
getMergePlanCount() |
protected Function<TableDescriptorBuilder,TableDescriptorBuilder> |
getMetaTableObserver() |
org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionState |
getMobCompactionState(TableName tableName)
Gets the mob file compaction state for a specific table.
|
(package private) NamespaceDescriptor |
getNamespace(String name)
Get a Namespace
|
(package private) List<NamespaceDescriptor> |
getNamespaces()
Get all Namespaces
|
int |
getNumWALFiles() |
List<Procedure<?>> |
getProcedures()
Get procedures
|
protected String |
getProcessName() |
QuotaObserverChore |
getQuotaObserverChore() |
RegionNormalizer |
getRegionNormalizer() |
RegionNormalizerTracker |
getRegionNormalizerTracker() |
MemoryBoundedLogMessageBuffer |
getRegionServerFatalLogBuffer() |
int |
getRegionServerInfoPort(ServerName sn) |
String |
getRegionServerVersion(ServerName sn) |
(package private) InetAddress |
getRemoteInetAddress(int port,
long serverStartCode) |
ReplicationPeerConfig |
getReplicationPeerConfig(String peerId)
Returns the configured ReplicationPeerConfig for the specified peer
|
ServerManager |
getServerManager() |
ServerName |
getServerName() |
SnapshotManager |
getSnapshotManager() |
SpaceQuotaSnapshotNotifier |
getSpaceQuotaSnapshotNotifier() |
SplitOrMergeTracker |
getSplitOrMergeTracker() |
long |
getSplitPlanCount() |
TableDescriptors |
getTableDescriptors() |
private List<TableDescriptor> |
getTableDescriptors(List<TableDescriptor> htds,
String namespace,
String regex,
List<TableName> tableNameList,
boolean includeSysTables) |
TableStateManager |
getTableStateManager() |
protected String |
getUseThisHostnameInstead(org.apache.hadoop.conf.Configuration conf) |
WALProcedureStore |
getWalProcedureStore() |
ZKWatcher |
getZooKeeper()
Gets the ZooKeeper instance for this server.
|
protected void |
initClusterSchemaService() |
protected void |
initializeZKBasedSystemTrackers()
Initialize all ZK based system trackers.
|
private void |
initMobCleaner() |
private void |
initQuotaManager() |
boolean |
isActiveMaster()
Report whether this master is currently the active master or not.
|
boolean |
isBalancerOn()
Queries the state of the
LoadBalancerTracker . |
(package private) boolean |
isCatalogJanitorEnabled() |
private static boolean |
isCatalogTable(TableName tableName) |
(package private) boolean |
isCleanerChoreEnabled() |
boolean |
isInitialized()
Report whether this master has completed with its initialization and is
ready.
|
boolean |
isInMaintenanceMode()
Report whether this master is in maintenance mode.
|
boolean |
isNormalizerOn()
Queries the state of the
RegionNormalizerTracker . |
private boolean |
isRegionOnline(RegionInfo ri) |
boolean |
isSplitOrMergeEnabled(MasterSwitchType switchType)
Queries the state of the
SplitOrMergeTracker . |
List<ServerName> |
listDecommissionedRegionServers()
List region servers marked as decommissioned (previously called 'draining') to not get regions
assigned to them.
|
List<ReplicationPeerDescription> |
listReplicationPeers(String regex)
Return a list of replication peers.
|
List<TableDescriptor> |
listTableDescriptors(String namespace,
String regex,
List<TableName> tableNameList,
boolean includeSysTables)
Returns the list of table descriptors that match the specified request
|
List<TableDescriptor> |
listTableDescriptorsByNamespace(String name)
Get list of table descriptors by namespace
|
List<TableName> |
listTableNames(String namespace,
String regex,
boolean includeSysTables)
Returns the list of table names that match the specified request
|
List<TableName> |
listTableNamesByNamespace(String name)
Get list of table names by namespace
|
protected void |
login(UserProvider user,
String host)
For compatibility, if failed with regionserver credentials, try the master one
|
static void |
main(String[] args) |
long |
mergeRegions(RegionInfo[] regionsToMerge,
boolean forcible,
long ng,
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 table
|
(package private) long |
modifyNamespace(NamespaceDescriptor newNsDescriptor,
long nonceGroup,
long nonce)
Modify an existing Namespace.
|
private long |
modifyTable(TableName tableName,
HMaster.TableDescriptorGetter newDescriptorGetter,
long nonceGroup,
long nonce) |
long |
modifyTable(TableName tableName,
TableDescriptor newDescriptor,
long nonceGroup,
long nonce)
Modify the descriptor of an existing table
|
void |
move(byte[] encodedRegionName,
byte[] destServerName) |
boolean |
normalizeRegions()
Perform normalization of cluster (invoked by
RegionNormalizerChore ). |
private int |
putUpJettyServer() |
void |
recommissionRegionServer(ServerName server,
List<byte[]> encodedRegionNames)
Remove decommission marker (previously called 'draining') from a region server to allow regions
assignments.
|
boolean |
registerService(com.google.protobuf.Service instance)
Registers a new protocol buffer
Service subclass as a coprocessor endpoint to be
available for handling |
void |
removeReplicationPeer(String peerId)
Removes a peer and stops the replication
|
void |
reportMobCompactionEnd(TableName tableName) |
void |
reportMobCompactionStart(TableName tableName) |
void |
requestMobCompaction(TableName tableName,
List<ColumnFamilyDescriptor> columns,
boolean allFiles)
Requests mob compaction.
|
long |
restoreSnapshot(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDesc,
long nonceGroup,
long nonce,
boolean restoreAcl) |
void |
run()
The HRegionServer sticks in this loop until closed.
|
private void |
sanityCheckTableDescriptor(TableDescriptor htd)
Checks whether the table conforms to some sane limits, and configured
values (compression, etc) work.
|
void |
setCatalogJanitorEnabled(boolean b)
Switch for the background CatalogJanitor thread.
|
void |
setInitialized(boolean isInitialized) |
void |
shutdown()
Shutdown the cluster.
|
long |
splitRegion(RegionInfo regionInfo,
byte[] splitRow,
long nonceGroup,
long nonce)
Split a region.
|
private void |
startActiveMasterManager(int infoPort) |
private void |
startProcedureExecutor() |
private void |
startServiceThreads() |
void |
stop(String msg)
Stop this service.
|
private void |
stopChores() |
void |
stopMaster() |
private void |
stopProcedureExecutor() |
protected void |
stopServiceThreads()
Wait on all threads to finish.
|
long |
truncateTable(TableName tableName,
boolean preserveSplits,
long nonceGroup,
long nonce)
Truncate a table
|
void |
updateConfigurationForQuotasObserver(org.apache.hadoop.conf.Configuration conf)
Adds the
MasterQuotasObserver to the list of configured Master observers to
automatically remove quotas for a table when that table is deleted. |
void |
updateReplicationPeerConfig(String peerId,
ReplicationPeerConfig peerConfig)
Update the peerConfig for the specified peer
|
protected void |
waitForMasterActive()
If configured to put regions on active master,
wait till a backup master becomes active.
|
private void |
waitForRegionServers(MonitoredTask status) |
boolean |
waitUntilMetaOnline()
Check hbase:meta is up and ready for reading.
|
boolean |
waitUntilNamespaceOnline()
Check hbase:namespace table is assigned.
|
private static void |
warnOrThrowExceptionForFailure(boolean logWarn,
String confKey,
String message,
Exception cause) |
abort, addRegion, addToMovedRegions, checkFileSystem, cleanMovedRegions, clearRegionBlockCache, closeAllRegions, closeAndOfflineRegionForSplitOrMerge, closeRegion, constructRegionServer, convertThrowableToIOE, createClusterConnection, createConnection, createRegionLoad, createRegionServerStatusStub, createRegionServerStatusStub, execRegionServerService, getCacheConfig, getChoreService, getClusterConnection, getClusterId, getCompactionPressure, getCompactionRequestor, getCompactSplitThread, getConfiguration, getConfigurationManager, getConnection, getCoordinatedStateManager, getEventLoopGroupConfig, getExecutorService, getFavoredNodesForRegion, getFileSystem, getFlushPressure, getFlushRequester, getFlushThroughputController, getFsTableDescriptors, getHeapMemoryManager, getInfoServer, getLastSequenceId, getLeases, getMasterAddressTracker, getMetaTableLocator, getMetrics, getMostLoadedRegions, getNonceManager, getNumberOfOnlineRegions, getOnlineRegion, getOnlineRegionsLocalContext, getOnlineTables, getRegion, getRegion, getRegionBlockLocations, getRegionByEncodedName, getRegionByEncodedName, getRegions, getRegions, getRegionServerAccounting, getRegionServerCoprocessorHost, getRegionServerCoprocessors, getRegionServerMetrics, getRegionServerRpcQuotaManager, getRegionServerSpaceQuotaManager, getRegionsInTransitionInRS, getReplicationSourceService, getRootDir, getRpcServer, getRSRpcServices, getSecureBulkLoadManager, getStartcode, getThreadWakeFrequency, getWAL, getWALFileSystem, getWalRoller, getWALRootDir, getWALs, handleReportForDutyResponse, initializeMemStoreChunkCreator, isAborted, isClusterUp, isOnline, isStopped, isStopping, kill, movedRegionCleanerPeriod, onConfigurationChange, postOpenDeployTasks, regionLock, removeRegion, reportRegionSizesForQuotas, reportRegionStateTransition, sendShutdownInterrupt, setupClusterConnection, stop, toString, tryRegionServerReport, unassign, updateConfiguration, updateRegionFavoredNodesMapping, waitForServerOnline, walRollRequestFinished
getName, getThread, interrupt, isAlive, isInterrupted, join, join, join, setDaemon, setName, setPriority, setUncaughtExceptionHandler, start
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getExecutorService, isClusterUp
createConnection, getChoreService, getClusterConnection, getConfiguration, getConnection, getCoordinatedStateManager, getFileSystem, getMetaTableLocator, isStopping
private static org.slf4j.Logger LOG
public static final String MASTER
private final ActiveMasterManager activeMasterManager
private RegionServerTracker regionServerTracker
private DrainingServerTracker drainingServerTracker
LoadBalancerTracker loadBalancerTracker
private SplitOrMergeTracker splitOrMergeTracker
private RegionNormalizerTracker regionNormalizerTracker
private ClusterSchemaService clusterSchemaService
public static final String HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS
public static final int DEFAULT_HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS
final MetricsMaster metricsMaster
private MasterFileSystem fileSystemManager
private MasterWalManager walManager
private volatile ServerManager serverManager
private AssignmentManager assignmentManager
private ReplicationManager replicationManager
MemoryBoundedLogMessageBuffer rsFatals
private volatile boolean activeMaster
private final ProcedureEvent initialized
volatile boolean serviceStarted
private final int maxBlancingTime
private final double maxRitPercent
private final LockManager lockManager
private LoadBalancer balancer
private RegionNormalizer normalizer
private BalancerChore balancerChore
private RegionNormalizerChore normalizerChore
private ClusterStatusChore clusterStatusChore
private ClusterStatusPublisher clusterStatusPublisherChore
CatalogJanitor catalogJanitorChore
private ReplicationZKNodeCleanerChore replicationZKNodeCleanerChore
private LogCleaner logCleaner
private HFileCleaner hfileCleaner
private ExpiredMobFileCleanerChore expiredMobFileCleanerChore
private MobCompactionChore mobCompactChore
private MasterMobCompactionThread mobCompactThread
private final IdLock mobCompactionLock
private Map<TableName,AtomicInteger> mobCompactionStates
MasterCoprocessorHost cpHost
private final boolean preLoadTableDescriptors
private long masterActiveTime
private long masterFinishedInitializationTime
private final boolean masterCheckCompression
private final boolean masterCheckEncryption
Map<String,com.google.protobuf.Service> coprocessorServiceHandlers
SnapshotManager snapshotManager
private MasterProcedureManagerHost mpmHost
private volatile MasterQuotaManager quotaManager
private SpaceQuotaSnapshotNotifier spaceQuotaSnapshotNotifier
private QuotaObserverChore quotaObserverChore
private SnapshotQuotaObserverChore snapshotQuotaChore
private ProcedureExecutor<MasterProcedureEnv> procedureExecutor
private WALProcedureStore procedureStore
private TableStateManager tableStateManager
private long splitPlanCount
private long mergePlanCount
private FavoredNodesManager favoredNodesManager
private org.eclipse.jetty.server.Server masterJettyServer
private final boolean maintenanceMode
static final String MAINTENANCE_MODE
public HMaster(org.apache.hadoop.conf.Configuration conf) throws IOException, org.apache.zookeeper.KeeperException
Remaining steps of initialization occur in #finishActiveMasterInitialization(MonitoredTask) after the master becomes the active one.
IOException
org.apache.zookeeper.KeeperException
protected String getUseThisHostnameInstead(org.apache.hadoop.conf.Configuration conf)
getUseThisHostnameInstead
in class HRegionServer
public void run()
HRegionServer
run
in interface Runnable
run
in class HRegionServer
private int putUpJettyServer() throws IOException
IOException
protected Function<TableDescriptorBuilder,TableDescriptorBuilder> getMetaTableObserver()
getMetaTableObserver
in class HRegionServer
protected void login(UserProvider user, String host) throws IOException
login
in class HRegionServer
IOException
protected void waitForMasterActive()
waitForMasterActive
in class HRegionServer
public MasterRpcServices getMasterRpcServices()
public boolean balanceSwitch(boolean b) throws IOException
IOException
protected String getProcessName()
getProcessName
in class HRegionServer
protected boolean canCreateBaseZNode()
canCreateBaseZNode
in class HRegionServer
protected boolean canUpdateTableDescriptor()
canUpdateTableDescriptor
in class HRegionServer
protected RSRpcServices createRpcServices() throws IOException
createRpcServices
in class HRegionServer
IOException
protected void configureInfoServer()
configureInfoServer
in class HRegionServer
protected Class<? extends javax.servlet.http.HttpServlet> getDumpServlet()
getDumpServlet
in class HRegionServer
public MetricsMaster getMasterMetrics()
getMasterMetrics
in interface MasterServices
MetricsMaster
protected void initializeZKBasedSystemTrackers() throws IOException, InterruptedException, org.apache.zookeeper.KeeperException
RegionServerTracker
, it
should have already been initialized along with ServerManager
.
Will be overridden in tests.IOException
InterruptedException
org.apache.zookeeper.KeeperException
private void finishActiveMasterInitialization(MonitoredTask status) throws IOException, InterruptedException, org.apache.zookeeper.KeeperException
IOException
InterruptedException
org.apache.zookeeper.KeeperException
public boolean waitUntilMetaOnline() throws InterruptedException
InterruptedException
private boolean isRegionOnline(RegionInfo ri) throws InterruptedException
InterruptedException
public boolean waitUntilNamespaceOnline() throws InterruptedException
InterruptedException
public void updateConfigurationForQuotasObserver(org.apache.hadoop.conf.Configuration conf)
MasterQuotasObserver
to the list of configured Master observers to
automatically remove quotas for a table when that table is deleted.private void initMobCleaner()
protected MasterMetaBootstrap createMetaBootstrap()
Create a MasterMetaBootstrap
instance.
Will be overridden in tests.
protected ServerManager createServerManager(MasterServices master) throws IOException
Create a ServerManager
instance.
Will be overridden in tests.
IOException
private void waitForRegionServers(MonitoredTask status) throws IOException, InterruptedException
IOException
InterruptedException
protected void initClusterSchemaService() throws IOException, InterruptedException
IOException
InterruptedException
private void initQuotaManager() throws IOException
IOException
private SpaceQuotaSnapshotNotifier createQuotaSnapshotNotifier()
boolean isCatalogJanitorEnabled()
boolean isCleanerChoreEnabled()
public TableDescriptors getTableDescriptors()
getTableDescriptors
in interface MasterServices
getTableDescriptors
in class HRegionServer
public ServerManager getServerManager()
getServerManager
in interface MasterServices
ServerManager
instance.public MasterFileSystem getMasterFileSystem()
getMasterFileSystem
in interface MasterServices
MasterFileSystem
utility class.public MasterWalManager getMasterWalManager()
getMasterWalManager
in interface MasterServices
MasterWalManager
utility class.public TableStateManager getTableStateManager()
getTableStateManager
in interface MasterServices
TableStateManager
private void startServiceThreads() throws IOException
IOException
protected void stopServiceThreads()
HRegionServer
stopServiceThreads
in class HRegionServer
private void createProcedureExecutor() throws IOException
IOException
private void startProcedureExecutor() throws IOException
IOException
private void stopProcedureExecutor()
private void stopChores()
InetAddress getRemoteInetAddress(int port, long serverStartCode) throws UnknownHostException
UnknownHostException
private int getMaxBalancingTime()
private int getMaxRegionsInTransition()
private void balanceThrottling(long nextBalanceStartTime, int maxRegionsInTransition, long cutoffTime)
nextBalanceStartTime
- The next balance plan start timemaxRegionsInTransition
- max number of regions in transitioncutoffTime
- when to exit balancerpublic boolean balance() throws IOException
IOException
public boolean balance(boolean force) throws IOException
IOException
public RegionNormalizer getRegionNormalizer()
getRegionNormalizer
in interface MasterServices
RegionNormalizer
public boolean normalizeRegions() throws IOException
RegionNormalizerChore
).IOException
public String getClientIdAuditPrefix()
getClientIdAuditPrefix
in interface MasterServices
public void setCatalogJanitorEnabled(boolean b)
b
- If false, the catalog janitor won't do anything.public long mergeRegions(RegionInfo[] regionsToMerge, boolean forcible, long ng, long nonce) throws IOException
MasterServices
mergeRegions
in interface MasterServices
regionsToMerge
- daughter regions to mergeforcible
- whether to force to merge even two regions are not adjacentng
- used to detect duplicatenonce
- used to detect duplicateIOException
public long splitRegion(RegionInfo regionInfo, byte[] splitRow, long nonceGroup, long nonce) throws IOException
MasterServices
splitRegion
in interface MasterServices
regionInfo
- region to splitsplitRow
- split pointnonceGroup
- used to detect duplicatenonce
- used to detect duplicateIOException
public void move(byte[] encodedRegionName, byte[] destServerName) throws HBaseIOException
HBaseIOException
public long createTable(TableDescriptor tableDescriptor, byte[][] splitKeys, long nonceGroup, long nonce) throws IOException
MasterServices
createTable
in interface MasterServices
tableDescriptor
- The table definitionsplitKeys
- Starting row keys for the initial table regions. If nullnonce
- a single region is created.IOException
public long createSystemTable(TableDescriptor tableDescriptor) throws IOException
MasterServices
createSystemTable
in interface MasterServices
tableDescriptor
- The system table definition
a single region is created.IOException
private void sanityCheckTableDescriptor(TableDescriptor htd) throws IOException
IOException
private void checkReplicationScope(ColumnFamilyDescriptor hcd) throws IOException
IOException
private void checkCompactionPolicy(org.apache.hadoop.conf.Configuration conf, TableDescriptor htd) throws IOException
IOException
private static void warnOrThrowExceptionForFailure(boolean logWarn, String confKey, String message, Exception cause) throws IOException
IOException
private void startActiveMasterManager(int infoPort) throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperException
private void checkCompression(TableDescriptor htd) throws IOException
IOException
private void checkCompression(ColumnFamilyDescriptor hcd) throws IOException
IOException
private void checkEncryption(org.apache.hadoop.conf.Configuration conf, TableDescriptor htd) throws IOException
IOException
private void checkEncryption(org.apache.hadoop.conf.Configuration conf, ColumnFamilyDescriptor hcd) throws IOException
IOException
private void checkClassLoading(org.apache.hadoop.conf.Configuration conf, TableDescriptor htd) throws IOException
IOException
private static boolean isCatalogTable(TableName tableName)
public long deleteTable(TableName tableName, long nonceGroup, long nonce) throws IOException
MasterServices
deleteTable
in interface MasterServices
tableName
- The table nameIOException
public long truncateTable(TableName tableName, boolean preserveSplits, long nonceGroup, long nonce) throws IOException
MasterServices
truncateTable
in interface MasterServices
tableName
- The table namepreserveSplits
- True if the splits should be preservedIOException
public long addColumn(TableName tableName, ColumnFamilyDescriptor column, long nonceGroup, long nonce) throws IOException
MasterServices
addColumn
in interface MasterServices
tableName
- The table namecolumn
- The column definitionIOException
public long modifyColumn(TableName tableName, ColumnFamilyDescriptor descriptor, long nonceGroup, long nonce) throws IOException
MasterServices
modifyColumn
in interface MasterServices
tableName
- The table namedescriptor
- The updated column definitionIOException
public long deleteColumn(TableName tableName, byte[] columnName, long nonceGroup, long nonce) throws IOException
MasterServices
deleteColumn
in interface MasterServices
tableName
- The table namecolumnName
- The column nameIOException
public long enableTable(TableName tableName, long nonceGroup, long nonce) throws IOException
MasterServices
enableTable
in interface MasterServices
tableName
- The table nameIOException
public long disableTable(TableName tableName, long nonceGroup, long nonce) throws IOException
MasterServices
disableTable
in interface MasterServices
tableName
- The table nameIOException
private long modifyTable(TableName tableName, HMaster.TableDescriptorGetter newDescriptorGetter, long nonceGroup, long nonce) throws IOException
IOException
public long modifyTable(TableName tableName, TableDescriptor newDescriptor, long nonceGroup, long nonce) throws IOException
MasterServices
modifyTable
in interface MasterServices
tableName
- The table namenewDescriptor
- The updated table descriptorIOException
public long restoreSnapshot(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDesc, long nonceGroup, long nonce, boolean restoreAcl) throws IOException
IOException
private void checkTableExists(TableName tableName) throws IOException, TableNotFoundException
IOException
TableNotFoundException
public void checkTableModifiable(TableName tableName) throws IOException, TableNotFoundException, TableNotDisabledException
MasterServices
checkTableModifiable
in interface MasterServices
tableName
- Name of table to check.TableNotDisabledException
TableNotFoundException
IOException
public ClusterMetrics getClusterMetricsWithoutCoprocessor() throws InterruptedIOException
InterruptedIOException
public ClusterMetrics getClusterMetricsWithoutCoprocessor(EnumSet<ClusterMetrics.Option> options) throws InterruptedIOException
InterruptedIOException
public ClusterMetrics getClusterMetrics() throws IOException
IOException
public ClusterMetrics getClusterMetrics(EnumSet<ClusterMetrics.Option> options) throws IOException
IOException
private List<ServerName> getBackupMasters() throws InterruptedIOException
InterruptedIOException
public static String getLoadedCoprocessors()
public long getMasterStartTime()
public long getMasterActiveTime()
public long getMasterFinishedInitializationTime()
public int getNumWALFiles()
public WALProcedureStore getWalProcedureStore()
public int getRegionServerInfoPort(ServerName sn)
public String getRegionServerVersion(ServerName sn)
getRegionServerVersion
in interface MasterServices
public void checkIfShouldMoveSystemRegionAsync()
MasterServices
checkIfShouldMoveSystemRegionAsync
in interface MasterServices
public String[] getMasterCoprocessors()
public void abort(String reason, Throwable cause)
HRegionServer
abort
in interface Abortable
abort
in class HRegionServer
reason
- the reason we are abortingcause
- the exception that caused the abort, or nullpublic ZKWatcher getZooKeeper()
Server
getZooKeeper
in interface Server
getZooKeeper
in class HRegionServer
public MasterCoprocessorHost getMasterCoprocessorHost()
getMasterCoprocessorHost
in interface MasterServices
MasterCoprocessorHost
public MasterQuotaManager getMasterQuotaManager()
getMasterQuotaManager
in interface MasterServices
MasterQuotaManager
public ProcedureExecutor<MasterProcedureEnv> getMasterProcedureExecutor()
getMasterProcedureExecutor
in interface MasterServices
ProcedureExecutor
public ServerName getServerName()
getServerName
in interface Server
getServerName
in class HRegionServer
public AssignmentManager getAssignmentManager()
getAssignmentManager
in interface MasterServices
AssignmentManager
public CatalogJanitor getCatalogJanitor()
getCatalogJanitor
in interface MasterServices
CatalogJanitor
public MemoryBoundedLogMessageBuffer getRegionServerFatalLogBuffer()
public void shutdown() throws IOException
IOException
public void stopMaster() throws IOException
IOException
public void stop(String msg)
Stoppable
stop
in interface Stoppable
stop
in class HRegionServer
msg
- Why we're stopping.void checkServiceStarted() throws ServerNotRunningYetException
ServerNotRunningYetException
void checkInitialized() throws PleaseHoldException, ServerNotRunningYetException, MasterNotRunningException, HMaster.MasterStoppedException
public boolean isActiveMaster()
isActiveMaster
in interface MasterServices
public boolean isInitialized()
isInitialized
in interface MasterServices
public boolean isInMaintenanceMode()
isInMaintenanceMode
in interface MasterServices
public void setInitialized(boolean isInitialized)
public ProcedureEvent getInitializedEvent()
getInitializedEvent
in interface MasterServices
public double getAverageLoad()
public long getSplitPlanCount()
public long getMergePlanCount()
public boolean registerService(com.google.protobuf.Service instance)
RegionServerServices
Service
subclass as a coprocessor endpoint to be
available for handlingregisterService
in interface MasterServices
registerService
in interface RegionServerServices
registerService
in class HRegionServer
instance
- the Service
subclass instance to expose as a coprocessor endpointtrue
if the registration was successful, false
public static HMaster constructMaster(Class<? extends HMaster> masterClass, org.apache.hadoop.conf.Configuration conf)
masterClass
- public static void main(String[] args)
HMasterCommandLine
public HFileCleaner getHFileCleaner()
public LogCleaner getLogCleaner()
public SnapshotManager getSnapshotManager()
getSnapshotManager
in interface MasterServices
public MasterProcedureManagerHost getMasterProcedureManagerHost()
getMasterProcedureManagerHost
in interface MasterServices
public ClusterSchema getClusterSchema()
getClusterSchema
in interface MasterServices
ClusterSchema
long createNamespace(NamespaceDescriptor namespaceDescriptor, long nonceGroup, long nonce) throws IOException
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 by
nonceGroup
(the source must ensure each operation gets a unique id).IOException
long modifyNamespace(NamespaceDescriptor newNsDescriptor, long nonceGroup, long nonce) throws IOException
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 by
nonceGroup
(the source must ensure each operation gets a unique id).IOException
long deleteNamespace(String name, long nonceGroup, long nonce) throws IOException
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 by
nonceGroup
(the source must ensure each operation gets a unique id).IOException
NamespaceDescriptor getNamespace(String name) throws IOException
name
- Name of the Namespacename
IOException
List<NamespaceDescriptor> getNamespaces() throws IOException
IOException
public List<TableName> listTableNamesByNamespace(String name) throws IOException
MasterServices
listTableNamesByNamespace
in interface MasterServices
name
- namespace nameIOException
public List<TableDescriptor> listTableDescriptorsByNamespace(String name) throws IOException
MasterServices
listTableDescriptorsByNamespace
in interface MasterServices
name
- namespace nameIOException
public boolean abortProcedure(long procId, boolean mayInterruptIfRunning) throws IOException
MasterServices
abortProcedure
in interface MasterServices
procId
- ID of the proceduremayInterruptIfRunning
- if the proc completed at least one step, should it be aborted?IOException
public List<Procedure<?>> getProcedures() throws IOException
MasterServices
getProcedures
in interface MasterServices
IOException
public List<LockedResource> getLocks() throws IOException
MasterServices
getLocks
in interface MasterServices
IOException
public List<TableDescriptor> listTableDescriptors(String namespace, String regex, List<TableName> tableNameList, boolean includeSysTables) throws IOException
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 tablesIOException
public List<TableName> listTableNames(String namespace, String regex, boolean includeSysTables) throws IOException
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 tablesIOException
private List<TableDescriptor> getTableDescriptors(List<TableDescriptor> htds, String namespace, String regex, List<TableName> tableNameList, boolean includeSysTables) throws IOException
IOException
private static void filterTablesByRegex(Collection<TableDescriptor> descriptors, Pattern pattern)
descriptors
- list of table descriptors to filterpattern
- the regex to usepublic long getLastMajorCompactionTimestamp(TableName table) throws IOException
getLastMajorCompactionTimestamp
in interface MasterServices
table
- the table for which last successful major compaction time is queriedIOException
public long getLastMajorCompactionTimestampForRegion(byte[] regionName) throws IOException
getLastMajorCompactionTimestampForRegion
in interface MasterServices
IOException
public org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionState getMobCompactionState(TableName tableName)
tableName
- The current table name.public void reportMobCompactionStart(TableName tableName) throws IOException
IOException
public void reportMobCompactionEnd(TableName tableName) throws IOException
IOException
public void requestMobCompaction(TableName tableName, List<ColumnFamilyDescriptor> columns, boolean allFiles) throws IOException
tableName
- The table the compact.columns
- The compacted columns.allFiles
- Whether add all mob files into the compaction.IOException
public boolean isBalancerOn()
LoadBalancerTracker
. If the balancer is not initialized,
false is returned.public boolean isNormalizerOn()
RegionNormalizerTracker
. If it's not initialized,
false is returned.public boolean isSplitOrMergeEnabled(MasterSwitchType switchType)
SplitOrMergeTracker
. If it is not initialized,
false is returned. If switchType is illegal, false will return.isSplitOrMergeEnabled
in interface MasterServices
switchType
- see MasterSwitchType
public String getLoadBalancerClassName()
LoadBalancer
class name. If none is set, a default is returned.LoadBalancer
in use.public RegionNormalizerTracker getRegionNormalizerTracker()
public SplitOrMergeTracker getSplitOrMergeTracker()
public LoadBalancer getLoadBalancer()
getLoadBalancer
in interface MasterServices
public FavoredNodesManager getFavoredNodesManager()
getFavoredNodesManager
in interface MasterServices
public void addReplicationPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled) throws ReplicationException, IOException
MasterServices
addReplicationPeer
in interface MasterServices
peerId
- a short name that identifies the peerpeerConfig
- configuration for the replication slave clusterenabled
- peer state, true if ENABLED and false if DISABLEDReplicationException
IOException
public void removeReplicationPeer(String peerId) throws ReplicationException, IOException
MasterServices
removeReplicationPeer
in interface MasterServices
peerId
- a short name that identifies the peerReplicationException
IOException
public void enableReplicationPeer(String peerId) throws ReplicationException, IOException
MasterServices
enableReplicationPeer
in interface MasterServices
peerId
- a short name that identifies the peerReplicationException
IOException
public void disableReplicationPeer(String peerId) throws ReplicationException, IOException
MasterServices
disableReplicationPeer
in interface MasterServices
peerId
- a short name that identifies the peerReplicationException
IOException
public ReplicationPeerConfig getReplicationPeerConfig(String peerId) throws ReplicationException, IOException
MasterServices
getReplicationPeerConfig
in interface MasterServices
peerId
- a short name that identifies the peerReplicationException
IOException
public void updateReplicationPeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws ReplicationException, IOException
MasterServices
updateReplicationPeerConfig
in interface MasterServices
peerId
- a short name that identifies the peerpeerConfig
- new config for the peerReplicationException
IOException
public List<ReplicationPeerDescription> listReplicationPeers(String regex) throws ReplicationException, IOException
MasterServices
listReplicationPeers
in interface MasterServices
regex
- The regular expression to match peer idReplicationException
IOException
public void decommissionRegionServers(List<ServerName> servers, boolean offload) throws HBaseIOException
servers
- Region servers to decommission.HBaseIOException
public List<ServerName> listDecommissionedRegionServers()
public void recommissionRegionServer(ServerName server, List<byte[]> encodedRegionNames) throws HBaseIOException
server
- Region server to remove decommission marker from.HBaseIOException
public LockManager getLockManager()
getLockManager
in interface MasterServices
LockManager
to lock namespaces/tables/regions.public QuotaObserverChore getQuotaObserverChore()
public SpaceQuotaSnapshotNotifier getSpaceQuotaSnapshotNotifier()
public static void decorateMasterConfiguration(org.apache.hadoop.conf.Configuration conf)
public HbckChore getHbckChore()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.