@InterfaceAudience.Private public class SplitLogManager extends Object
SplitLogManager monitors the tasks that it creates using the
timeoutMonitor thread. If a task's progress is slow then
SplitLogManagerCoordination.checkTasks()
will take away the
task from the owner SplitLogWorker
and the task will be up for grabs again. When the task is done then it is deleted
by SplitLogManager.
Clients call splitLogDistributed(Path)
to split a region server's
log files. The caller thread waits in this method until all the log files
have been split.
All the coordination calls made by this class are asynchronous. This is mainly to help reduce response time seen by the callers.
There is race in this design between the SplitLogManager and the SplitLogWorker. SplitLogManager might re-queue a task that has in reality already been completed by a SplitLogWorker. We rely on the idempotency of the log splitting task for correctness.
It is also assumed that every log splitting task is unique and once completed (either with success or with error) it will be not be submitted again. If a task is resubmitted then there is a risk that old "delete task" can delete the re-submission.
Modifier and Type | Class and Description |
---|---|
static class |
SplitLogManager.ResubmitDirective |
static class |
SplitLogManager.Task
in memory state of an active task.
|
static class |
SplitLogManager.TaskBatch
Keeps track of the batch of tasks submitted together by a caller in splitLogDistributed().
|
static class |
SplitLogManager.TerminationStatus |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_UNASSIGNED_TIMEOUT |
protected ReentrantLock |
recoveringRegionLock
In distributedLogReplay mode, we need touch both splitlog and recovering-regions znodes in one
operation.
|
Constructor and Description |
---|
SplitLogManager(Server server,
Configuration conf,
Stoppable stopper,
MasterServices master,
ServerName serverName)
Its OK to construct this object even when region-servers are not online.
|
Modifier and Type | Method and Description |
---|---|
static FileStatus[] |
getFileList(Configuration conf,
List<Path> logDirs,
PathFilter filter)
Get a list of paths that need to be split given a set of server-specific directories and
optionally a filter.
|
ZooKeeperProtos.SplitLogTask.RecoveryMode |
getRecoveryMode() |
boolean |
isLogReplaying() |
boolean |
isLogSplitting() |
void |
markRegionsRecovering(ServerName server,
Set<HRegionInfo> userRegions) |
void |
setRecoveryMode(boolean isForInitialization)
This function is to set recovery mode from outstanding split log tasks from before or current
configuration setting
|
long |
splitLogDistributed(List<Path> logDirs)
The caller will block until all the log files of the given region server have been processed -
successfully split or an error is encountered - by an available worker region server.
|
long |
splitLogDistributed(Path logDir) |
long |
splitLogDistributed(Set<ServerName> serverNames,
List<Path> logDirs,
PathFilter filter)
The caller will block until all the hbase:meta log files of the given region server have been
processed - successfully split or an error is encountered - by an available worker region
server.
|
void |
stop() |
public static final int DEFAULT_UNASSIGNED_TIMEOUT
protected final ReentrantLock recoveringRegionLock
public SplitLogManager(Server server, Configuration conf, Stoppable stopper, MasterServices master, ServerName serverName) throws IOException
server
- the server instanceconf
- the HBase configurationstopper
- the stoppable in case anything is wrongmaster
- the master servicesserverName
- the master server nameIOException
public static FileStatus[] getFileList(Configuration conf, List<Path> logDirs, PathFilter filter) throws IOException
DefaultWALProvider.getServerNameFromWALDirectoryName(Configuration, java.lang.String)
for more info on directory
layout.
Should be package-private, but is needed by
WALSplitter.split(Path, Path, Path, FileSystem,
Configuration, WALFactory)
for tests.IOException
public long splitLogDistributed(Path logDir) throws IOException
logDir
- one region sever wal dir path in .logsIOException
- if there was an error while splitting any log fileIOException
public long splitLogDistributed(List<Path> logDirs) throws IOException
logDirs
- List of log dirs to splitIOException
- If there was an error while splitting any log filepublic long splitLogDistributed(Set<ServerName> serverNames, List<Path> logDirs, PathFilter filter) throws IOException
logDirs
- List of log dirs to splitfilter
- the Path filter to select specific files for consideringIOException
- If there was an error while splitting any log filepublic void stop()
public void setRecoveryMode(boolean isForInitialization) throws IOException
isForInitialization
- IOException
- throws if it's impossible to set recovery modepublic void markRegionsRecovering(ServerName server, Set<HRegionInfo> userRegions) throws InterruptedIOException, IOException
InterruptedIOException
IOException
public boolean isLogReplaying()
public boolean isLogSplitting()
public ZooKeeperProtos.SplitLogTask.RecoveryMode getRecoveryMode()