@InterfaceAudience.LimitedPrivate(value="Tools") public class HRegionServer extends HasThread implements RegionServerServices, LastSequenceId
Modifier and Type | Class and Description |
---|---|
private static class |
HRegionServer.CompactionChecker |
private static class |
HRegionServer.MovedRegionInfo |
protected static class |
HRegionServer.MovedRegionsCleaner
Creates a Chore thread to clean the moved region cache.
|
(package private) static class |
HRegionServer.PeriodicMemstoreFlusher |
RegionServerServices.PostOpenDeployContext, RegionServerServices.RegionStateTransitionContext
Modifier and Type | Field and Description |
---|---|
private boolean |
abortRequested |
protected CacheConfig |
cacheConfig |
protected MemStoreFlusher |
cacheFlusher |
private ChoreService |
choreService
ChoreService used to schedule tasks that we want to run periodically
|
protected static String |
CLOSE |
protected ClusterConnection |
clusterConnection
Cluster connection to be shared by services.
|
private String |
clusterId
Unique identifier for the cluster we are a part of.
|
protected ClusterStatusTracker |
clusterStatusTracker |
(package private) ScheduledChore |
compactionChecker |
CompactSplitThread |
compactSplitThread |
protected org.apache.hadoop.conf.Configuration |
conf |
protected ConfigurationManager |
configurationManager
Configuration manager is used to register/deregister and notify the configuration observers
when the regionserver is notified that there was a change in the on disk configs.
|
private Map<String,com.google.protobuf.Service> |
coprocessorServiceHandlers |
protected BaseCoordinatedStateManager |
csm |
protected HFileSystem |
fs |
protected boolean |
fsOk |
private HealthCheckChore |
healthCheckChore
The health check chore.
|
protected HeapMemoryManager |
hMemManager |
protected InfoServer |
infoServer |
private boolean |
killed |
protected Leases |
leases |
protected ReentrantReadWriteLock |
lock |
private static org.apache.commons.logging.Log |
LOG |
protected static String |
MASTER_HOSTNAME_KEY |
private MasterAddressTracker |
masterAddressTracker |
protected MetaTableLocator |
metaTableLocator |
(package private) AtomicReference<LogRoller> |
metawalRoller |
(package private) MetricsRegionServer |
metricsRegionServer |
protected Map<String,HRegionServer.MovedRegionInfo> |
movedRegions |
private HRegionServer.MovedRegionsCleaner |
movedRegionsCleaner
Chore to clean periodically the moved region list
|
protected int |
msgInterval |
private ObjectName |
mxBean
MX Bean for RegionServerInfo
|
(package private) ServerNonceManager |
nonceManager
Nonce manager.
|
private ScheduledChore |
nonceManagerChore
The nonce manager chore.
|
protected int |
numRegionsToReport |
(package private) int |
numRetries |
(package private) AtomicBoolean |
online |
protected Map<String,Region> |
onlineRegions
Map of regions currently being served by this region server.
|
protected static String |
OPEN |
private int |
operationTimeout |
private JvmPauseMonitor |
pauseMonitor |
(package private) ScheduledChore |
periodicFlusher |
protected Map<String,Region> |
recoveringRegions
Set of regions currently being in recovering state which means it can accept writes(edits from
previous failed region server) but not reads.
|
private RecoveringRegionWatcher |
recoveringRegionWatcher |
protected Map<String,InetSocketAddress[]> |
regionFavoredNodesMap
Map of encoded region names to the DataNode locations they should be hosted on
We store the value as InetSocketAddress since this is used only in HDFS
API (create() that takes favored nodes as hints for placing file blocks).
|
static String |
REGIONSERVER
region server process name
|
private RegionServerAccounting |
regionServerAccounting |
protected ConcurrentMap<byte[],Boolean> |
regionsInTransitionInRS |
protected ReplicationSinkService |
replicationSinkHandler |
protected ReplicationSourceService |
replicationSourceHandler |
private org.apache.hadoop.fs.Path |
rootDir |
(package private) ConcurrentMap<String,Integer> |
rowlocks |
(package private) RpcClient |
rpcClient |
private RpcControllerFactory |
rpcControllerFactory |
private RpcRetryingCallerFactory |
rpcRetryingCallerFactory |
protected RSRpcServices |
rpcServices |
(package private) static String |
RS_HOSTNAME_KEY |
private RegionServerCoprocessorHost |
rsHost |
private RegionServerProcedureManagerHost |
rspmHost |
private RegionServerQuotaManager |
rsQuotaManager |
private org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionServerStatusService.BlockingInterface |
rssStub |
protected ServerName |
serverName
The server name the Master sees us as.
|
protected ExecutorService |
service |
private int |
shortOperationTimeout |
protected Sleeper |
sleeper |
private SpanReceiverHost |
spanReceiverHost |
private SplitLogWorker |
splitLogWorker |
protected long |
startcode
This servers startcode.
|
private boolean |
stopped |
private boolean |
stopping |
private StorefileRefresherChore |
storefileRefresher |
protected TableDescriptors |
tableDescriptors
Go here to get table descriptors.
|
protected TableLockManager |
tableLockManager |
protected int |
threadWakeFrequency |
private static int |
TIMEOUT_REGION_MOVED |
private Thread.UncaughtExceptionHandler |
uncaughtExceptionHandler |
private static byte[] |
UNSPECIFIED_REGION |
private UserProvider |
userProvider |
protected String |
useThisHostnameInstead |
private boolean |
useZKForAssignment |
protected WALFactory |
walFactory |
(package private) LogRoller |
walRoller |
protected ZooKeeperWatcher |
zooKeeper |
Constructor and Description |
---|
HRegionServer(org.apache.hadoop.conf.Configuration conf)
Starts a HRegionServer at the default location.
|
HRegionServer(org.apache.hadoop.conf.Configuration conf,
CoordinatedStateManager csm)
Starts a HRegionServer at the default location
|
Modifier and Type | Method and Description |
---|---|
void |
abort(String reason) |
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.
|
protected void |
addToMovedRegions(String encodedName,
ServerName destination,
long closeSeqNum) |
void |
addToOnlineRegions(Region region)
Add to online regions.
|
private boolean |
areAllUserRegionsOffline() |
private void |
blockAndCheckIfStopped(ZooKeeperNodeTracker tracker)
Utilty method to wait indefinitely on a znode availability while checking
if the region server is shut down
|
(package private) org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.ServerLoad |
buildServerLoad(long reportStartTime,
long reportEndTime) |
protected boolean |
canCreateBaseZNode() |
protected boolean |
canUpdateTableDescriptor() |
private static void |
checkCodecs(org.apache.hadoop.conf.Configuration c)
Run test on configured codecs to make sure supporting libs are in place.
|
boolean |
checkFileSystem()
Checks to see if the file system is still accessible.
|
protected void |
cleanMovedRegions()
Remove the expired entries from the moved regions list.
|
private Throwable |
cleanup(Throwable t,
String msg) |
protected void |
closeAllRegions(boolean abort)
Closes all regions.
|
(package private) void |
closeMetaTableRegions(boolean abort)
Close meta region if we carry it
|
protected boolean |
closeRegion(String encodedName,
boolean abort,
CloseRegionCoordination.CloseRegionDetails crd,
ServerName sn)
Close asynchronously a region, can be called from the master or internally by the regionserver
when stopping.
|
private void |
closeRegionIgnoreErrors(HRegionInfo region,
boolean abort)
Try to close the region, logs a warning on failure but continues.
|
(package private) void |
closeUserRegions(boolean abort)
Schedule closes on all user regions.
|
protected void |
configureInfoServer() |
static HRegionServer |
constructRegionServer(Class<? extends HRegionServer> regionServerClass,
org.apache.hadoop.conf.Configuration conf2,
CoordinatedStateManager cp)
Utility for constructing an instance of the passed HRegionServer class.
|
private boolean |
containsMetaTableRegions() |
protected IOException |
convertThrowableToIOE(Throwable t,
String msg) |
protected ClusterConnection |
createClusterConnection()
Create a 'smarter' HConnection, one that is capable of by-passing RPC if the request is to
the local server.
|
private void |
createMyEphemeralNode() |
private static void |
createNewReplicationInstance(org.apache.hadoop.conf.Configuration conf,
HRegionServer server,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path logDir,
org.apache.hadoop.fs.Path oldLogDir)
Load the replication service objects, if any
|
private org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionLoad |
createRegionLoad(Region r,
org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionLoad.Builder regionLoadBldr,
org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier.Builder regionSpecifier) |
org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionLoad |
createRegionLoad(String encodedRegionName) |
protected ServerName |
createRegionServerStatusStub()
Get the current master from ZooKeeper and open the RPC connection to it.
|
protected ServerName |
createRegionServerStatusStub(boolean refresh)
Get the current master from ZooKeeper and open the RPC connection to it.
|
protected RSRpcServices |
createRpcServices() |
private void |
deleteMyEphemeralNode() |
protected LogRoller |
ensureMetaWALRoller()
We initialize the roller for the wal that handles meta lazily
since we don't know if this regionserver will handle it.
|
org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse |
execRegionServerService(com.google.protobuf.RpcController controller,
org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceRequest serviceRequest) |
CacheConfig |
getCacheConfig() |
ChoreService |
getChoreService() |
String |
getClusterId() |
double |
getCompactionPressure() |
CompactionRequestor |
getCompactionRequester() |
CompactSplitThread |
getCompactSplitThread() |
org.apache.hadoop.conf.Configuration |
getConfiguration()
Gets the configuration object for this server.
|
protected ConfigurationManager |
getConfigurationManager() |
ClusterConnection |
getConnection()
Returns a reference to the servers' cluster connection.
|
BaseCoordinatedStateManager |
getCoordinatedStateManager()
Get CoordinatedStateManager instance for this server.
|
(package private) SortedMap<Long,Region> |
getCopyOfOnlineRegionsSortedBySize() |
protected Class<? extends javax.servlet.http.HttpServlet> |
getDumpServlet() |
ExecutorService |
getExecutorService() |
InetSocketAddress[] |
getFavoredNodesForRegion(String encodedRegionName)
Return the favored nodes for a region given its encoded name.
|
org.apache.hadoop.fs.FileSystem |
getFileSystem() |
FlushRequester |
getFlushRequester() |
Region |
getFromOnlineRegions(String encodedRegionName)
Return
Region instance. |
HeapMemoryManager |
getHeapMemoryManager() |
InfoServer |
getInfoServer() |
private String |
getLastFailedRSFromZK(String encodedRegionName)
Return the last failed RS name under /hbase/recovering-regions/encodedRegionName
|
org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionStoreSequenceIds |
getLastSequenceId(byte[] encodedRegionName) |
Leases |
getLeases() |
MasterAddressTracker |
getMasterAddressTracker() |
MetaTableLocator |
getMetaTableLocator()
Returns instance of
MetaTableLocator
running inside this server. |
protected HRegionInfo[] |
getMostLoadedRegions()
Get the top N most loaded regions this server is serving so we can tell the
master which regions it can reallocate if we're overloaded.
|
private HRegionServer.MovedRegionInfo |
getMovedRegion(String encodedRegionName) |
private String |
getMyEphemeralNodePath() |
ServerNonceManager |
getNonceManager()
Only required for "old" log replay; if it's removed, remove this.
|
int |
getNumberOfOnlineRegions() |
Region |
getOnlineRegion(byte[] regionName) |
List<Region> |
getOnlineRegions(TableName tableName)
Gets the online regions of the specified table.
|
(package private) String |
getOnlineRegionsAsPrintableString() |
Collection<Region> |
getOnlineRegionsLocalContext()
For tests, web ui and metrics.
|
Set<TableName> |
getOnlineTables()
Gets the online tables in this RS.
|
protected String |
getProcessName() |
Map<String,Region> |
getRecoveringRegions() |
protected Region |
getRegion(byte[] regionName)
Protected utility method for safely obtaining an HRegion handle.
|
InetSocketAddress[] |
getRegionBlockLocations(String encodedRegionName) |
protected Region |
getRegionByEncodedName(byte[] regionName,
String encodedRegionName) |
Region |
getRegionByEncodedName(String encodedRegionName) |
RegionServerAccounting |
getRegionServerAccounting() |
RegionServerCoprocessorHost |
getRegionServerCoprocessorHost() |
String[] |
getRegionServerCoprocessors() |
MetricsRegionServer |
getRegionServerMetrics() |
RegionServerQuotaManager |
getRegionServerQuotaManager() |
ConcurrentMap<byte[],Boolean> |
getRegionsInTransitionInRS()
Get the regions that are currently being opened or closed in the RS
|
(package private) ReplicationSinkService |
getReplicationSinkService() |
ReplicationSourceService |
getReplicationSourceService() |
protected org.apache.hadoop.fs.Path |
getRootDir() |
RpcServerInterface |
getRpcServer()
Returns a reference to the region server's RPC server
|
RSRpcServices |
getRSRpcServices() |
ServerName |
getServerName() |
long |
getStartcode() |
TableDescriptors |
getTableDescriptors() |
TableLockManager |
getTableLockManager() |
int |
getThreadWakeFrequency()
Interval at which threads should run
|
WAL |
getWAL(HRegionInfo regionInfo) |
(package private) ReentrantReadWriteLock.WriteLock |
getWriteLock() |
private long |
getWriteRequestCount() |
ZooKeeperWatcher |
getZooKeeper()
Gets the ZooKeeper instance for this server.
|
protected void |
handleReportForDutyResponse(org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionServerStartupResponse c) |
private void |
initializeFileSystem() |
private void |
initializeThreads() |
private void |
initializeZooKeeper()
Bring up connection to zk ensemble and then wait until a master for this
cluster and then after that, wait until cluster 'up' flag has been set.
|
boolean |
isAborted()
Check if the server or client was aborted.
|
private boolean |
isClusterUp() |
private boolean |
isHealthCheckerConfigured() |
private boolean |
isHealthy() |
boolean |
isOnline()
Report the status of the server.
|
(package private) boolean |
isOnlineRegionsEmpty() |
boolean |
isStopped() |
boolean |
isStopping() |
private boolean |
keepLooping() |
protected void |
kill() |
protected void |
login(UserProvider user,
String host) |
static void |
main(String[] args) |
protected int |
movedRegionCleanerPeriod() |
private static ReplicationService |
newReplicationInstance(String classname,
org.apache.hadoop.conf.Configuration conf,
HRegionServer server,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path logDir,
org.apache.hadoop.fs.Path oldLogDir) |
void |
postOpenDeployTasks(Region r)
Tasks to perform after region open to complete deploy of region on
regionserver
|
void |
postOpenDeployTasks(RegionServerServices.PostOpenDeployContext context)
Tasks to perform after region open to complete deploy of region on
regionserver
|
private void |
preRegistrationInitialization()
All initialization needed before we go register with Master.
|
private int |
putUpWebUI()
Puts up the webui.
|
private void |
registerConfigurationObservers() |
boolean |
registerService(com.google.protobuf.Service instance)
Registers a new protocol buffer
Service subclass as a coprocessor endpoint to be
available for handling |
(package private) void |
removeFromMovedRegions(String encodedName) |
boolean |
removeFromOnlineRegions(Region r,
ServerName destination)
This method removes Region corresponding to hri from the Map of onlineRegions.
|
private org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionServerStartupResponse |
reportForDuty() |
boolean |
reportRegionStateTransition(RegionServerServices.RegionStateTransitionContext context)
Notify master that a handler requests to change a region state
|
boolean |
reportRegionStateTransition(org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode code,
HRegionInfo... hris)
Notify master that a handler requests to change a region state
|
boolean |
reportRegionStateTransition(org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode code,
long openSeqNum,
HRegionInfo... hris)
Notify master that a handler requests to change a region state
|
void |
run()
The HRegionServer sticks in this loop until closed.
|
protected void |
sendShutdownInterrupt()
Called on stop/abort before closing the cluster connection and meta locator.
|
protected void |
setupClusterConnection()
Setup our cluster connection if not already initialized.
|
private WALFactory |
setupWALAndReplication()
Setup WAL log and replication if enabled.
|
protected boolean |
shouldUseThisHostnameInstead() |
private void |
shutdownWAL(boolean close) |
private boolean |
sleep(long millis) |
private void |
startHeapMemoryManager() |
private void |
startServiceThreads() |
void |
stop(String msg)
Stop this service.
|
void |
stop(String msg,
boolean force)
Stops the regionserver.
|
protected void |
stopServiceThreads()
Wait on all threads to finish.
|
String |
toString() |
(package private) void |
triggerFlushInPrimaryRegion(HRegion region)
Trigger a flush in the primary region replica if this region is a secondary replica.
|
protected void |
tryRegionServerReport(long reportStartTime,
long reportEndTime) |
void |
updateConfiguration()
Reload the configuration from disk.
|
private void |
updateRecoveringRegionLastFlushedSequenceId(Region r)
A helper function to store the last flushed sequence Id with the previous failed RS for a
recovering region.
|
void |
updateRegionFavoredNodesMapping(String encodedRegionName,
List<org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName> favoredNodes)
Used to update the favored nodes mapping when required.
|
protected void |
waitForMasterActive() |
void |
waitForServerOnline() |
private void |
waitOnAllRegionsToClose(boolean abort)
Wait on regions close.
|
boolean |
walRollRequestFinished()
For testing
|
getName, getThread, interrupt, isAlive, isInterrupted, join, join, join, setDaemon, setName, setPriority, setUncaughtExceptionHandler, start
private static final org.apache.commons.logging.Log LOG
protected static final String OPEN
protected static final String CLOSE
protected final ConcurrentMap<byte[],Boolean> regionsInTransitionInRS
protected MemStoreFlusher cacheFlusher
protected HeapMemoryManager hMemManager
protected ClusterConnection clusterConnection
protected MetaTableLocator metaTableLocator
private RecoveringRegionWatcher recoveringRegionWatcher
protected TableDescriptors tableDescriptors
protected ReplicationSourceService replicationSourceHandler
protected ReplicationSinkService replicationSinkHandler
public CompactSplitThread compactSplitThread
protected final Map<String,Region> onlineRegions
protected final Map<String,InetSocketAddress[]> regionFavoredNodesMap
protected final Map<String,Region> recoveringRegions
protected Leases leases
protected ExecutorService service
protected volatile boolean fsOk
protected HFileSystem fs
private volatile boolean stopped
private volatile boolean abortRequested
ConcurrentMap<String,Integer> rowlocks
private boolean stopping
private volatile boolean killed
protected final org.apache.hadoop.conf.Configuration conf
private org.apache.hadoop.fs.Path rootDir
protected final ReentrantReadWriteLock lock
final int numRetries
protected final int threadWakeFrequency
protected final int msgInterval
protected final int numRegionsToReport
private volatile org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionServerStatusService.BlockingInterface rssStub
RpcClient rpcClient
private RpcRetryingCallerFactory rpcRetryingCallerFactory
private RpcControllerFactory rpcControllerFactory
private Thread.UncaughtExceptionHandler uncaughtExceptionHandler
protected InfoServer infoServer
private JvmPauseMonitor pauseMonitor
public static final String REGIONSERVER
MetricsRegionServer metricsRegionServer
private SpanReceiverHost spanReceiverHost
private final ChoreService choreService
ScheduledChore compactionChecker
ScheduledChore periodicFlusher
protected volatile WALFactory walFactory
final LogRoller walRoller
final AtomicReference<LogRoller> metawalRoller
final AtomicBoolean online
protected ZooKeeperWatcher zooKeeper
private MasterAddressTracker masterAddressTracker
protected ClusterStatusTracker clusterStatusTracker
private SplitLogWorker splitLogWorker
protected final Sleeper sleeper
private final int operationTimeout
private final int shortOperationTimeout
private final RegionServerAccounting regionServerAccounting
protected CacheConfig cacheConfig
private HealthCheckChore healthCheckChore
private ScheduledChore nonceManagerChore
private Map<String,com.google.protobuf.Service> coprocessorServiceHandlers
protected ServerName serverName
protected String useThisHostnameInstead
@InterfaceAudience.LimitedPrivate(value="Configuration") static final String RS_HOSTNAME_KEY
@InterfaceAudience.LimitedPrivate(value="Configuration") protected static final String MASTER_HOSTNAME_KEY
protected final long startcode
private String clusterId
private ObjectName mxBean
private HRegionServer.MovedRegionsCleaner movedRegionsCleaner
private StorefileRefresherChore storefileRefresher
private RegionServerCoprocessorHost rsHost
private RegionServerProcedureManagerHost rspmHost
private RegionServerQuotaManager rsQuotaManager
protected TableLockManager tableLockManager
final ServerNonceManager nonceManager
private UserProvider userProvider
protected final RSRpcServices rpcServices
protected BaseCoordinatedStateManager csm
private final boolean useZKForAssignment
protected final ConfigurationManager configurationManager
private static final byte[] UNSPECIFIED_REGION
protected Map<String,HRegionServer.MovedRegionInfo> movedRegions
private static final int TIMEOUT_REGION_MOVED
public HRegionServer(org.apache.hadoop.conf.Configuration conf) throws IOException, InterruptedException
IOException
InterruptedException
public HRegionServer(org.apache.hadoop.conf.Configuration conf, CoordinatedStateManager csm) throws IOException, InterruptedException
csm
- implementation of CoordinatedStateManager to be usedIOException
InterruptedException
private void initializeFileSystem() throws IOException
IOException
protected boolean shouldUseThisHostnameInstead()
protected void login(UserProvider user, String host) throws IOException
IOException
protected void waitForMasterActive()
protected String getProcessName()
protected boolean canCreateBaseZNode()
protected boolean canUpdateTableDescriptor()
protected RSRpcServices createRpcServices() throws IOException
IOException
protected void configureInfoServer()
protected Class<? extends javax.servlet.http.HttpServlet> getDumpServlet()
public boolean registerService(com.google.protobuf.Service instance)
RegionServerServices
Service
subclass as a coprocessor endpoint to be
available for handlingregisterService
in interface RegionServerServices
instance
- the Service
subclass instance to expose as a coprocessor endpointtrue
if the registration was successful, false
protected ClusterConnection createClusterConnection() throws IOException
IOException
private static void checkCodecs(org.apache.hadoop.conf.Configuration c) throws IOException
c
- IOException
public String getClusterId()
protected void setupClusterConnection() throws IOException
IOException
private void preRegistrationInitialization()
IOException
InterruptedException
private void initializeZooKeeper() throws IOException, InterruptedException
IOException
InterruptedException
private void blockAndCheckIfStopped(ZooKeeperNodeTracker tracker) throws IOException, InterruptedException
tracker
- znode tracker to useIOException
- any IO exception, plus if the RS is stoppedInterruptedException
private boolean isClusterUp()
private void initializeThreads() throws IOException
IOException
private void registerConfigurationObservers()
public void run()
private boolean containsMetaTableRegions()
private boolean areAllUserRegionsOffline()
private long getWriteRequestCount()
protected void tryRegionServerReport(long reportStartTime, long reportEndTime) throws IOException
IOException
org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.ServerLoad buildServerLoad(long reportStartTime, long reportEndTime) throws IOException
IOException
String getOnlineRegionsAsPrintableString()
private void waitOnAllRegionsToClose(boolean abort)
private boolean sleep(long millis)
private void shutdownWAL(boolean close)
protected void handleReportForDutyResponse(org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionServerStartupResponse c) throws IOException
IOException
private void startHeapMemoryManager()
private void createMyEphemeralNode() throws org.apache.zookeeper.KeeperException, IOException
org.apache.zookeeper.KeeperException
IOException
private void deleteMyEphemeralNode() throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperException
public RegionServerAccounting getRegionServerAccounting()
getRegionServerAccounting
in interface RegionServerServices
public TableLockManager getTableLockManager()
getTableLockManager
in interface RegionServerServices
TableLockManager
private org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionLoad createRegionLoad(Region r, org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionLoad.Builder regionLoadBldr, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier.Builder regionSpecifier) throws IOException
IOException
public org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionLoad createRegionLoad(String encodedRegionName) throws IOException
encodedRegionName
- IOException
public boolean isOnline()
private WALFactory setupWALAndReplication() throws IOException
IOException
protected LogRoller ensureMetaWALRoller()
public MetricsRegionServer getRegionServerMetrics()
public MasterAddressTracker getMasterAddressTracker()
private void startServiceThreads() throws IOException
IOException
private int putUpWebUI() throws IOException
IOException
private boolean isHealthy()
public WAL getWAL(HRegionInfo regionInfo) throws IOException
getWAL
in interface RegionServerServices
IOException
public ClusterConnection getConnection()
Server
getConnection
in interface Server
public MetaTableLocator getMetaTableLocator()
Server
MetaTableLocator
running inside this server. This MetaServerLocator is started and stopped by server, clients
shouldn't manage it's lifecycle.getMetaTableLocator
in interface Server
MetaTableLocator
associated with this server.public void stop(String msg, boolean force)
msg
- Status messageforce
- True if this is a regionserver abortpublic void waitForServerOnline()
public void postOpenDeployTasks(Region r) throws org.apache.zookeeper.KeeperException, IOException
RegionServerServices
postOpenDeployTasks
in interface RegionServerServices
r
- Region to open.org.apache.zookeeper.KeeperException
IOException
public void postOpenDeployTasks(RegionServerServices.PostOpenDeployContext context) throws org.apache.zookeeper.KeeperException, IOException
RegionServerServices
postOpenDeployTasks
in interface RegionServerServices
context
- the contextorg.apache.zookeeper.KeeperException
IOException
public boolean reportRegionStateTransition(org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode code, HRegionInfo... hris)
RegionServerServices
reportRegionStateTransition
in interface RegionServerServices
public boolean reportRegionStateTransition(org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode code, long openSeqNum, HRegionInfo... hris)
RegionServerServices
reportRegionStateTransition
in interface RegionServerServices
public boolean reportRegionStateTransition(RegionServerServices.RegionStateTransitionContext context)
RegionServerServices
reportRegionStateTransition
in interface RegionServerServices
void triggerFlushInPrimaryRegion(HRegion region)
public RpcServerInterface getRpcServer()
RegionServerServices
getRpcServer
in interface RegionServerServices
public RSRpcServices getRSRpcServices()
public void abort(String reason, Throwable cause)
public void abort(String reason)
abort(String, Throwable)
public boolean isAborted()
Abortable
protected void kill()
protected void sendShutdownInterrupt()
protected void stopServiceThreads()
public ReplicationSourceService getReplicationSourceService()
ReplicationSinkService getReplicationSinkService()
protected ServerName createRegionServerStatusStub()
protected ServerName createRegionServerStatusStub(boolean refresh)
refresh
- If true then master address will be read from ZK, otherwise use cached dataprivate boolean keepLooping()
private org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionServerStartupResponse reportForDuty() throws IOException
IOException
public org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionStoreSequenceIds getLastSequenceId(byte[] encodedRegionName)
getLastSequenceId
in interface LastSequenceId
encodedRegionName
- Encoded region nameprotected void closeAllRegions(boolean abort)
void closeMetaTableRegions(boolean abort)
abort
- Whether we're running an abort.void closeUserRegions(boolean abort)
abort
- Whether we're running an abort.public InfoServer getInfoServer()
public boolean isStopped()
public boolean isStopping()
isStopping
in interface RegionServerServices
public Map<String,Region> getRecoveringRegions()
getRecoveringRegions
in interface RegionServerServices
public org.apache.hadoop.conf.Configuration getConfiguration()
Server
getConfiguration
in interface Server
ReentrantReadWriteLock.WriteLock getWriteLock()
public int getNumberOfOnlineRegions()
boolean isOnlineRegionsEmpty()
public Collection<Region> getOnlineRegionsLocalContext()
public void addToOnlineRegions(Region region)
OnlineRegions
addToOnlineRegions
in interface OnlineRegions
SortedMap<Long,Region> getCopyOfOnlineRegionsSortedBySize()
public long getStartcode()
public FlushRequester getFlushRequester()
getFlushRequester
in interface RegionServerServices
protected HRegionInfo[] getMostLoadedRegions()
public Leases getLeases()
getLeases
in interface RegionServerServices
protected org.apache.hadoop.fs.Path getRootDir()
public org.apache.hadoop.fs.FileSystem getFileSystem()
getFileSystem
in interface RegionServerServices
public int getThreadWakeFrequency()
public ZooKeeperWatcher getZooKeeper()
Server
getZooKeeper
in interface Server
public BaseCoordinatedStateManager getCoordinatedStateManager()
Server
getCoordinatedStateManager
in interface Server
public ServerName getServerName()
getServerName
in interface Server
public CompactionRequestor getCompactionRequester()
getCompactionRequester
in interface RegionServerServices
CompactionRequestor
or null.public RegionServerCoprocessorHost getRegionServerCoprocessorHost()
public ConcurrentMap<byte[],Boolean> getRegionsInTransitionInRS()
RegionServerServices
getRegionsInTransitionInRS
in interface RegionServerServices
public ExecutorService getExecutorService()
getExecutorService
in interface RegionServerServices
public ChoreService getChoreService()
getChoreService
in interface Server
ChoreService
instance for this serverpublic RegionServerQuotaManager getRegionServerQuotaManager()
getRegionServerQuotaManager
in interface RegionServerServices
RegionServerQuotaManager
private static void createNewReplicationInstance(org.apache.hadoop.conf.Configuration conf, HRegionServer server, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path logDir, org.apache.hadoop.fs.Path oldLogDir) throws IOException
IOException
private static ReplicationService newReplicationInstance(String classname, org.apache.hadoop.conf.Configuration conf, HRegionServer server, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path logDir, org.apache.hadoop.fs.Path oldLogDir) throws IOException
IOException
public static HRegionServer constructRegionServer(Class<? extends HRegionServer> regionServerClass, org.apache.hadoop.conf.Configuration conf2, CoordinatedStateManager cp)
regionServerClass
- conf2
- public static void main(String[] args) throws Exception
Exception
HRegionServerCommandLine
public List<Region> getOnlineRegions(TableName tableName)
hbase:meta
.
Only returns online regions. If a region on this table has been
closed during a disable, etc., it will not be included in the returned list.
So, the returned list may not necessarily be ALL regions in this table, its
all the ONLINE regions in the table.getOnlineRegions
in interface OnlineRegions
tableName
- tableName
public Set<TableName> getOnlineTables()
getOnlineTables
in interface RegionServerServices
public String[] getRegionServerCoprocessors()
private void closeRegionIgnoreErrors(HRegionInfo region, boolean abort)
region
- Region to closeprotected boolean closeRegion(String encodedName, boolean abort, CloseRegionCoordination.CloseRegionDetails crd, ServerName sn) throws NotServingRegionException, RegionAlreadyInTransitionException
If an opening was in progress, this method will cancel it, but will not start a new close. The coprocessors are not called in this case. A NotServingRegionException exception is thrown.
If a close was in progress, this new request will be ignored, and an exception thrown.
encodedName
- Region to closeabort
- True if we are abortingcrd
- details about closing region coordination-coordinated taskNotServingRegionException
- if the region is not onlineRegionAlreadyInTransitionException
- if the region is already closingpublic Region getOnlineRegion(byte[] regionName)
regionName
- regionName
or null if
named region is not member of the online regions.public InetSocketAddress[] getRegionBlockLocations(String encodedRegionName)
public Region getFromOnlineRegions(String encodedRegionName)
OnlineRegions
Region
instance.
Only works if caller is in same context, in same JVM. Region is not
serializable.getFromOnlineRegions
in interface OnlineRegions
encodedRegionName
or
null if named region is not member of the online regions.public boolean removeFromOnlineRegions(Region r, ServerName destination)
OnlineRegions
removeFromOnlineRegions
in interface OnlineRegions
r
- Region to remove.destination
- Destination, if any, null otherwise.protected Region getRegion(byte[] regionName) throws NotServingRegionException
regionName
- Name of online Region
to returnRegion
for regionName
NotServingRegionException
public Region getRegionByEncodedName(String encodedRegionName) throws NotServingRegionException
NotServingRegionException
protected Region getRegionByEncodedName(byte[] regionName, String encodedRegionName) throws NotServingRegionException
NotServingRegionException
protected IOException convertThrowableToIOE(Throwable t, String msg)
public boolean checkFileSystem()
public void updateRegionFavoredNodesMapping(String encodedRegionName, List<org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName> favoredNodes)
FavoredNodesForRegion
updateRegionFavoredNodesMapping
in interface FavoredNodesForRegion
public InetSocketAddress[] getFavoredNodesForRegion(String encodedRegionName)
regionFavoredNodesMap
on why it is InetSocketAddress[]getFavoredNodesForRegion
in interface FavoredNodesForRegion
encodedRegionName
- public ServerNonceManager getNonceManager()
RegionServerServices
getNonceManager
in interface RegionServerServices
protected void addToMovedRegions(String encodedName, ServerName destination, long closeSeqNum)
void removeFromMovedRegions(String encodedName)
private HRegionServer.MovedRegionInfo getMovedRegion(String encodedRegionName)
protected void cleanMovedRegions()
protected int movedRegionCleanerPeriod()
private String getMyEphemeralNodePath()
private boolean isHealthCheckerConfigured()
public CompactSplitThread getCompactSplitThread()
CompactSplitThread
for the serversprivate void updateRecoveringRegionLastFlushedSequenceId(Region r) throws org.apache.zookeeper.KeeperException, IOException
org.apache.zookeeper.KeeperException
IOException
private String getLastFailedRSFromZK(String encodedRegionName) throws org.apache.zookeeper.KeeperException
encodedRegionName
- org.apache.zookeeper.KeeperException
public org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse execRegionServerService(com.google.protobuf.RpcController controller, org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceRequest serviceRequest) throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public CacheConfig getCacheConfig()
protected ConfigurationManager getConfigurationManager()
public TableDescriptors getTableDescriptors()
public void updateConfiguration()
public HeapMemoryManager getHeapMemoryManager()
getHeapMemoryManager
in interface RegionServerServices
public double getCompactionPressure()
getCompactionPressure
in interface RegionServerServices
Store.getCompactionPressure()
public boolean walRollRequestFinished()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.