@InterfaceAudience.LimitedPrivate(value="Tools") public class HMaster extends HRegionServer implements MasterServices, Server
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.
|
private static class |
HMaster.PeriodicDoMetrics |
static class |
HMaster.RedirectServlet |
HRegionServer.MovedRegionsCleaner
RegionServerServices.PostOpenDeployContext, RegionServerServices.RegionStateTransitionContext
cacheConfig, cacheFlusher, CLOSE, clusterConnection, clusterStatusTracker, compactSplitThread, conf, configurationManager, csm, fs, fsOk, hMemManager, infoServer, leases, lock, MASTER_HOSTNAME_KEY, metaTableLocator, movedRegions, msgInterval, numRegionsToReport, onlineRegions, OPEN, recoveringRegions, regionFavoredNodesMap, REGIONSERVER, regionsInTransitionInRS, replicationSinkHandler, replicationSourceHandler, rpcServices, serverName, service, sleeper, startcode, tableDescriptors, tableLockManager, threadWakeFrequency, useThisHostnameInstead, walFactory, zooKeeper
Constructor and Description |
---|
HMaster(org.apache.hadoop.conf.Configuration conf,
CoordinatedStateManager csm)
Initializes the HMaster.
|
Modifier and Type | Method and Description |
---|---|
void |
abort(String msg,
Throwable t)
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.
|
void |
addColumn(TableName tableName,
HColumnDescriptor columnDescriptor,
long nonceGroup,
long nonce)
Add a new column to an existing table
|
(package private) void |
assignMeta(MonitoredTask status,
Set<ServerName> previouslyFailedMetaRSs,
int replicaId)
Check
hbase:meta is assigned. |
private void |
assignMetaZkLess(RegionStates regionStates,
RegionState regionState,
long timeout,
Set<ServerName> previouslyFailedRs) |
void |
assignRegion(HRegionInfo hri) |
boolean |
balance() |
boolean |
balanceSwitch(boolean b) |
protected boolean |
canCreateBaseZNode() |
protected boolean |
canUpdateTableDescriptor() |
private void |
checkClassLoading(org.apache.hadoop.conf.Configuration conf,
HTableDescriptor htd) |
private void |
checkCompactionPolicy(org.apache.hadoop.conf.Configuration conf,
HTableDescriptor htd) |
private void |
checkCompression(HColumnDescriptor hcd) |
private void |
checkCompression(HTableDescriptor htd) |
private void |
checkEncryption(org.apache.hadoop.conf.Configuration conf,
HColumnDescriptor hcd) |
private void |
checkEncryption(org.apache.hadoop.conf.Configuration conf,
HTableDescriptor htd) |
(package private) void |
checkInitialized() |
(package private) void |
checkNamespaceManagerReady() |
(package private) void |
checkServiceStarted() |
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,
CoordinatedStateManager cp)
Utility for constructing an instance of the passed HMaster class.
|
protected CatalogJanitor |
createCatalogJanitor() |
void |
createNamespace(NamespaceDescriptor descriptor)
Create a new namespace
|
protected RSRpcServices |
createRpcServices() |
(package private) ServerManager |
createServerManager(Server master,
MasterServices services)
Create a
ServerManager instance. |
long |
createTable(HTableDescriptor hTableDescriptor,
byte[][] splitKeys,
long nonceGroup,
long nonce)
Create a table using the given table definition.
|
void |
deleteColumn(TableName tableName,
byte[] columnName,
long nonceGroup,
long nonce)
Delete a column from an existing table
|
void |
deleteNamespace(String name)
Delete an existing namespace.
|
long |
deleteTable(TableName tableName,
long nonceGroup,
long nonce)
Delete a table
|
long |
disableTable(TableName tableName,
long nonceGroup,
long nonce)
Disable an existing table
|
void |
dispatchMergingRegions(HRegionInfo region_a,
HRegionInfo region_b,
boolean forcible)
Merge two regions.
|
private void |
doMetrics()
Emit the HMaster metrics, such as region in transition metrics.
|
private void |
enableCrashedServerProcessing(boolean waitForMeta) |
private void |
enableMeta(TableName metaTableName) |
long |
enableTable(TableName tableName,
long nonceGroup,
long nonce)
Enable an existing table
|
protected void |
ensureNamespaceExists(String name)
Ensure that the specified namespace exists, otherwise throws a NamespaceNotFoundException
|
private static void |
filterTablesByRegex(Collection<HTableDescriptor> 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 int |
getBalancerCutoffTime() |
(package private) String |
getClientIdAuditPrefix() |
ClusterStatus |
getClusterStatus() |
protected Class<? extends javax.servlet.http.HttpServlet> |
getDumpServlet() |
HFileCleaner |
getHFileCleaner() |
MasterProcedureScheduler.ProcedureEvent |
getInitializedEvent() |
long |
getLastMajorCompactionTimestamp(TableName table) |
long |
getLastMajorCompactionTimestampForRegion(byte[] regionName) |
String |
getLoadBalancerClassName()
Fetch the configured
LoadBalancer class name. |
static String |
getLoadedCoprocessors()
The set of loaded coprocessors is stored in a static set.
|
long |
getMasterActiveTime() |
MasterCoprocessorHost |
getMasterCoprocessorHost() |
String[] |
getMasterCoprocessors() |
MasterFileSystem |
getMasterFileSystem() |
(package private) MetricsMaster |
getMasterMetrics() |
ProcedureExecutor<MasterProcedureEnv> |
getMasterProcedureExecutor() |
MasterQuotaManager |
getMasterQuotaManager() |
MasterRpcServices |
getMasterRpcServices() |
long |
getMasterStartTime() |
NamespaceDescriptor |
getNamespaceDescriptor(String name)
Get a namespace descriptor by name
|
private Set<ServerName> |
getPreviouselyFailedMetaServersFromZK()
This function returns a set of region server names under hbase:meta recovering region ZK node
|
protected String |
getProcessName() |
RegionNormalizerTracker |
getRegionNormalizerTracker() |
MemoryBoundedLogMessageBuffer |
getRegionServerFatalLogBuffer() |
int |
getRegionServerInfoPort(ServerName sn) |
String |
getRegionServerVersion(ServerName sn) |
(package private) InetAddress |
getRemoteInetAddress(int port,
long serverStartCode) |
MasterProcedureScheduler.ProcedureEvent |
getServerCrashProcessingEnabledEvent() |
ServerManager |
getServerManager() |
ServerName |
getServerName() |
SnapshotManager |
getSnapshotManager()
Exposed for TESTING!
|
TableDescriptors |
getTableDescriptors() |
(package private) Pair<HRegionInfo,ServerName> |
getTableRegionForRow(TableName tableName,
byte[] rowKey)
Return the region and current deployment for the region containing
the given row.
|
ZooKeeperWatcher |
getZooKeeper()
Gets the ZooKeeper instance for this server.
|
(package private) void |
initializeZKBasedSystemTrackers()
Initialize all ZK based system trackers.
|
(package private) void |
initNamespace() |
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) |
boolean |
isInitializationStartsMetaRegionAssignment()
Report whether this master has started initialization and is about to do meta region assignment
|
boolean |
isInitialized()
Report whether this master has completed with its initialization and is
ready.
|
boolean |
isNormalizerOn()
Queries the state of the
RegionNormalizerTracker . |
boolean |
isServerCrashProcessingEnabled()
ServerCrashProcessingEnabled is set false before completing assignMeta to prevent processing
of crashed servers.
|
List<NamespaceDescriptor> |
listNamespaceDescriptors()
List available namespace descriptors
|
List<ProcedureInfo> |
listProcedures()
List procedures
|
List<HTableDescriptor> |
listTableDescriptors(String namespace,
String regex,
List<TableName> tableNameList,
boolean includeSysTables)
Returns the list of table descriptors that match the specified request
|
List<HTableDescriptor> |
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) |
void |
modifyColumn(TableName tableName,
HColumnDescriptor descriptor,
long nonceGroup,
long nonce)
Modify the column descriptor of an existing column in an existing table
|
void |
modifyNamespace(NamespaceDescriptor descriptor)
Modify an existing namespace
|
void |
modifyTable(TableName tableName,
HTableDescriptor descriptor,
long nonceGroup,
long nonce)
Modify the descriptor of an existing table
|
(package private) void |
move(byte[] encodedRegionName,
byte[] destServerName) |
boolean |
normalizeRegions()
Perform normalization of cluster (invoked by
RegionNormalizerChore ). |
private int |
putUpJettyServer() |
boolean |
registerService(com.google.protobuf.Service instance)
Registers a new protocol buffer
Service subclass as a coprocessor endpoint to be
available for handling |
private void |
sanityCheckTableDescriptor(HTableDescriptor htd)
Checks whether the table conforms to some sane limits, and configured
values (compression, etc) work.
|
protected void |
sendShutdownInterrupt()
Called on stop/abort before closing the cluster connection and meta locator.
|
void |
setCatalogJanitorEnabled(boolean b)
Switch for the background CatalogJanitor thread.
|
void |
setInitialized(boolean isInitialized) |
void |
setServerCrashProcessingEnabled(boolean b) |
void |
shutdown() |
private void |
splitMetaLogBeforeAssignment(ServerName currentMetaServer) |
private void |
startActiveMasterManager(int infoPort) |
private void |
startProcedureExecutor() |
private void |
startServiceThreads() |
private void |
stopChores() |
void |
stopMaster() |
private void |
stopProcedureExecutor() |
protected void |
stopServiceThreads()
Wait on all threads to finish.
|
void |
truncateTable(TableName tableName,
boolean preserveSplits,
long nonceGroup,
long nonce)
Truncate a table
|
private void |
unassignExcessMetaReplica(ZooKeeperWatcher zkw,
int numMetaReplicasConfigured) |
protected void |
waitForMasterActive()
If configured to put regions on active master,
wait till a backup master becomes active.
|
private static void |
warnOrThrowExceptionForFailure(boolean logWarn,
String confKey,
String message,
Exception cause) |
abort, addToMovedRegions, addToOnlineRegions, checkFileSystem, cleanMovedRegions, closeAllRegions, closeRegion, constructRegionServer, convertThrowableToIOE, createClusterConnection, createRegionLoad, createRegionServerStatusStub, createRegionServerStatusStub, ensureMetaWALRoller, execRegionServerService, getCacheConfig, getChoreService, getClusterId, getCompactionPressure, getCompactionRequester, getCompactSplitThread, getConfiguration, getConfigurationManager, getConnection, getCoordinatedStateManager, getExecutorService, getFavoredNodesForRegion, getFileSystem, getFlushRequester, getFromOnlineRegions, getHeapMemoryManager, getInfoServer, getLastSequenceId, getLeases, getMasterAddressTracker, getMetaTableLocator, getMostLoadedRegions, getNonceManager, getNumberOfOnlineRegions, getOnlineRegion, getOnlineRegions, getOnlineRegionsLocalContext, getOnlineTables, getRecoveringRegions, getRegion, getRegionBlockLocations, getRegionByEncodedName, getRegionByEncodedName, getRegionServerAccounting, getRegionServerCoprocessorHost, getRegionServerCoprocessors, getRegionServerMetrics, getRegionServerQuotaManager, getRegionsInTransitionInRS, getReplicationSourceService, getRootDir, getRpcServer, getRSRpcServices, getStartcode, getTableLockManager, getThreadWakeFrequency, getWAL, handleReportForDutyResponse, isAborted, isOnline, isStopped, isStopping, kill, movedRegionCleanerPeriod, postOpenDeployTasks, postOpenDeployTasks, removeFromOnlineRegions, reportRegionStateTransition, reportRegionStateTransition, reportRegionStateTransition, run, setupClusterConnection, shouldUseThisHostnameInstead, stop, stop, toString, tryRegionServerReport, 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, getTableLockManager
getChoreService, getConfiguration, getConnection, getCoordinatedStateManager, getMetaTableLocator
private static final org.apache.commons.logging.Log LOG
public static final String MASTER
private final ActiveMasterManager activeMasterManager
RegionServerTracker regionServerTracker
private DrainingServerTracker drainingServerTracker
LoadBalancerTracker loadBalancerTracker
private RegionNormalizerTracker regionNormalizerTracker
private TableNamespaceManager tableNamespaceManager
final MetricsMaster metricsMaster
private MasterFileSystem fileSystemManager
volatile ServerManager serverManager
AssignmentManager assignmentManager
MemoryBoundedLogMessageBuffer rsFatals
private volatile boolean isActiveMaster
private final MasterProcedureScheduler.ProcedureEvent initialized
volatile boolean serviceStarted
private final MasterProcedureScheduler.ProcedureEvent serverCrashProcessingEnabled
LoadBalancer balancer
private RegionNormalizer normalizer
private BalancerChore balancerChore
private RegionNormalizerChore normalizerChore
private ClusterStatusChore clusterStatusChore
private ClusterStatusPublisher clusterStatusPublisherChore
private HMaster.PeriodicDoMetrics periodicDoMetricsChore
CatalogJanitor catalogJanitorChore
private ReplicationZKLockCleanerChore replicationZKLockCleanerChore
private LogCleaner logCleaner
private HFileCleaner hfileCleaner
MasterCoprocessorHost cpHost
private final boolean preLoadTableDescriptors
private long masterActiveTime
private final boolean masterCheckCompression
private final boolean masterCheckEncryption
SnapshotManager snapshotManager
MasterProcedureManagerHost mpmHost
private volatile MasterQuotaManager quotaManager
private ProcedureExecutor<MasterProcedureEnv> procedureExecutor
private WALProcedureStore procedureStore
private volatile boolean initializationBeforeMetaAssignment
private org.mortbay.jetty.Server masterJettyServer
public HMaster(org.apache.hadoop.conf.Configuration conf, CoordinatedStateManager csm) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
Remaining steps of initialization occur in #finishActiveMasterInitialization(MonitoredTask) after the master becomes the active one.
InterruptedException
org.apache.zookeeper.KeeperException
IOException
private int putUpJettyServer() throws IOException
IOException
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
private void doMetrics()
MetricsMaster getMasterMetrics()
void initializeZKBasedSystemTrackers() throws IOException, InterruptedException, org.apache.zookeeper.KeeperException, CoordinatedStateException
IOException
InterruptedException
org.apache.zookeeper.KeeperException
CoordinatedStateException
private void finishActiveMasterInitialization(MonitoredTask status) throws IOException, InterruptedException, org.apache.zookeeper.KeeperException, CoordinatedStateException
IOException
InterruptedException
org.apache.zookeeper.KeeperException
CoordinatedStateException
protected CatalogJanitor createCatalogJanitor()
private void initQuotaManager() throws IOException
IOException
ServerManager createServerManager(Server master, MasterServices services) throws IOException
ServerManager
instance.master
- services
- ServerManager
ZooKeeperConnectionException
IOException
private void unassignExcessMetaReplica(ZooKeeperWatcher zkw, int numMetaReplicasConfigured)
void assignMeta(MonitoredTask status, Set<ServerName> previouslyFailedMetaRSs, int replicaId) throws InterruptedException, IOException, org.apache.zookeeper.KeeperException
hbase:meta
is assigned. If not, assign it.status
- MonitoredTaskpreviouslyFailedMetaRSs
- replicaId
- InterruptedException
IOException
org.apache.zookeeper.KeeperException
private void assignMetaZkLess(RegionStates regionStates, RegionState regionState, long timeout, Set<ServerName> previouslyFailedRs) throws IOException, org.apache.zookeeper.KeeperException
IOException
org.apache.zookeeper.KeeperException
void initNamespace() throws IOException
IOException
boolean isCatalogJanitorEnabled()
private void splitMetaLogBeforeAssignment(ServerName currentMetaServer) throws IOException
IOException
private void enableCrashedServerProcessing(boolean waitForMeta) throws IOException, InterruptedException
IOException
InterruptedException
private void enableMeta(TableName metaTableName)
private Set<ServerName> getPreviouselyFailedMetaServersFromZK() throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperException
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.private void startServiceThreads() throws IOException
IOException
protected void sendShutdownInterrupt()
HRegionServer
sendShutdownInterrupt
in class HRegionServer
protected void stopServiceThreads()
HRegionServer
stopServiceThreads
in class HRegionServer
private void startProcedureExecutor() throws IOException
IOException
private void stopProcedureExecutor()
private void stopChores()
InetAddress getRemoteInetAddress(int port, long serverStartCode) throws UnknownHostException
UnknownHostException
private int getBalancerCutoffTime()
public boolean balance() throws IOException
IOException
public boolean normalizeRegions() throws IOException, CoordinatedStateException
RegionNormalizerChore
).IOException
CoordinatedStateException
String getClientIdAuditPrefix()
public void setCatalogJanitorEnabled(boolean b)
b
- If false, the catalog janitor won't do anything.public void dispatchMergingRegions(HRegionInfo region_a, HRegionInfo region_b, boolean forcible) throws IOException
MasterServices
dispatchMergingRegions
in interface MasterServices
region_a
- region to mergeregion_b
- region to mergeforcible
- true if do a compulsory merge, otherwise we will only merge
two adjacent regionsIOException
void move(byte[] encodedRegionName, byte[] destServerName) throws HBaseIOException
HBaseIOException
public long createTable(HTableDescriptor hTableDescriptor, byte[][] splitKeys, long nonceGroup, long nonce) throws IOException
MasterServices
createTable
in interface MasterServices
hTableDescriptor
- The table definitionsplitKeys
- Starting row keys for the initial table regions. If nullnonce
- a single region is created.IOException
private void sanityCheckTableDescriptor(HTableDescriptor htd) throws IOException
IOException
private void checkCompactionPolicy(org.apache.hadoop.conf.Configuration conf, HTableDescriptor 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(HTableDescriptor htd) throws IOException
IOException
private void checkCompression(HColumnDescriptor hcd) throws IOException
IOException
private void checkEncryption(org.apache.hadoop.conf.Configuration conf, HTableDescriptor htd) throws IOException
IOException
private void checkEncryption(org.apache.hadoop.conf.Configuration conf, HColumnDescriptor hcd) throws IOException
IOException
private void checkClassLoading(org.apache.hadoop.conf.Configuration conf, HTableDescriptor 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 void 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 void addColumn(TableName tableName, HColumnDescriptor columnDescriptor, long nonceGroup, long nonce) throws IOException
MasterServices
addColumn
in interface MasterServices
tableName
- The table namecolumnDescriptor
- The column definitionIOException
public void modifyColumn(TableName tableName, HColumnDescriptor descriptor, long nonceGroup, long nonce) throws IOException
MasterServices
modifyColumn
in interface MasterServices
tableName
- The table namedescriptor
- The updated column definitionIOException
public void 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
Pair<HRegionInfo,ServerName> getTableRegionForRow(TableName tableName, byte[] rowKey) throws IOException
IOException
public void modifyTable(TableName tableName, HTableDescriptor descriptor, long nonceGroup, long nonce) throws IOException
MasterServices
modifyTable
in interface MasterServices
tableName
- The table namedescriptor
- The updated table descriptorIOException
public void checkTableModifiable(TableName tableName) throws IOException, TableNotFoundException, TableNotDisabledException
MasterServices
checkTableModifiable
in interface MasterServices
tableName
- Name of table to check.TableNotDisabledException
TableNotFoundException
IOException
public ClusterStatus getClusterStatus() throws InterruptedIOException
InterruptedIOException
public static String getLoadedCoprocessors()
public long getMasterStartTime()
public long getMasterActiveTime()
public int getRegionServerInfoPort(ServerName sn)
public String getRegionServerVersion(ServerName sn)
public String[] getMasterCoprocessors()
public void abort(String msg, Throwable t)
HRegionServer
abort
in interface Abortable
abort
in class HRegionServer
msg
- the reason we are abortingt
- the exception that caused the abort, or nullpublic ZooKeeperWatcher 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 MemoryBoundedLogMessageBuffer getRegionServerFatalLogBuffer()
public void shutdown() throws IOException
IOException
public void stopMaster() throws IOException
IOException
void checkServiceStarted() throws ServerNotRunningYetException
ServerNotRunningYetException
void checkInitialized() throws PleaseHoldException, ServerNotRunningYetException
void checkNamespaceManagerReady() throws IOException
IOException
public boolean isActiveMaster()
public boolean isInitialized()
isInitialized
in interface MasterServices
public void setInitialized(boolean isInitialized)
public MasterProcedureScheduler.ProcedureEvent getInitializedEvent()
public boolean isServerCrashProcessingEnabled()
isServerCrashProcessingEnabled
in interface MasterServices
public void setServerCrashProcessingEnabled(boolean b)
public MasterProcedureScheduler.ProcedureEvent getServerCrashProcessingEnabledEvent()
public boolean isInitializationStartsMetaRegionAssignment()
public void assignRegion(HRegionInfo hri)
public double getAverageLoad()
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, CoordinatedStateManager cp)
masterClass
- conf
- public static void main(String[] args)
HMasterCommandLine
public HFileCleaner getHFileCleaner()
public SnapshotManager getSnapshotManager()
public void createNamespace(NamespaceDescriptor descriptor) throws IOException
MasterServices
createNamespace
in interface MasterServices
descriptor
- descriptor which describes the new namespaceIOException
public void modifyNamespace(NamespaceDescriptor descriptor) throws IOException
MasterServices
modifyNamespace
in interface MasterServices
descriptor
- descriptor which updates the existing namespaceIOException
public void deleteNamespace(String name) throws IOException
MasterServices
deleteNamespace
in interface MasterServices
name
- namespace nameIOException
protected void ensureNamespaceExists(String name) throws IOException, NamespaceNotFoundException
name
- the namespace to checkIOException
- if the namespace manager is not ready yet.NamespaceNotFoundException
- if the namespace does not existspublic NamespaceDescriptor getNamespaceDescriptor(String name) throws IOException
MasterServices
getNamespaceDescriptor
in interface MasterServices
name
- name of namespace descriptorIOException
public List<NamespaceDescriptor> listNamespaceDescriptors() throws IOException
MasterServices
listNamespaceDescriptors
in interface MasterServices
IOException
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<ProcedureInfo> listProcedures() throws IOException
MasterServices
listProcedures
in interface MasterServices
IOException
public List<HTableDescriptor> listTableDescriptorsByNamespace(String name) throws IOException
MasterServices
listTableDescriptorsByNamespace
in interface MasterServices
name
- namespace nameIOException
public List<TableName> listTableNamesByNamespace(String name) throws IOException
MasterServices
listTableNamesByNamespace
in interface MasterServices
name
- namespace nameIOException
public List<HTableDescriptor> 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 static void filterTablesByRegex(Collection<HTableDescriptor> descriptors, Pattern pattern)
descriptors
- list of table descriptors to filterpattern
- the regex to usepublic long getLastMajorCompactionTimestamp(TableName table) throws IOException
getLastMajorCompactionTimestamp
in interface MasterServices
IOException
public long getLastMajorCompactionTimestampForRegion(byte[] regionName) throws IOException
getLastMajorCompactionTimestampForRegion
in interface MasterServices
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 String getLoadBalancerClassName()
LoadBalancer
class name. If none is set, a default is returned.LoadBalancer
in use.public RegionNormalizerTracker getRegionNormalizerTracker()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.