@InterfaceAudience.Private public class SplitWALManager extends Object
SplitWALProcedure for each WAL which need to split. Manage the workers for each
 SplitWALProcedure. Total number of workers is (number of online servers) *
 (HBASE_SPLIT_WAL_MAX_SPLITTER). Helps assign and release workers for split tasks. Provide helper
 method to delete split WAL file and directory. The user can get the SplitWALProcedures via
 splitWALs(crashedServer, splitMeta) can get the files that need to split via
 getWALsToSplit(crashedServer, splitMeta) can delete the splitting WAL and directory via
 deleteSplitWAL(wal) and deleteSplitWAL(crashedServer) can check if splitting WALs of a crashed
 server is success via isSplitWALFinished(walPath) can acquire and release a worker for splitting
 WAL via acquireSplitWALWorker(procedure) and releaseSplitWALWorker(worker, scheduler) This class
 is to replace the zk-based WAL splitting related code, MasterWalManager,
 SplitLogManager, ZKSplitLog and
 ZKSplitLogManagerCoordination can be removed after
 we switch to procedure-based WAL splitting.| Modifier and Type | Class and Description | 
|---|---|
private static class  | 
SplitWALManager.SplitWorkerAssigner
help assign and release a worker for each WAL splitting task For each worker, concurrent
 running splitting task should be no more than maxSplitTasks If a task failed to acquire a
 worker, it will suspend and wait for workers available 
 | 
| Modifier and Type | Field and Description | 
|---|---|
private org.apache.hadoop.conf.Configuration | 
conf  | 
private org.apache.hadoop.fs.FileSystem | 
fs  | 
private static org.slf4j.Logger | 
LOG  | 
private MasterServices | 
master  | 
private org.apache.hadoop.fs.Path | 
rootDir  | 
private SplitWALManager.SplitWorkerAssigner | 
splitWorkerAssigner  | 
private org.apache.hadoop.fs.Path | 
walArchiveDir  | 
| Constructor and Description | 
|---|
SplitWALManager(MasterServices master)  | 
| Modifier and Type | Method and Description | 
|---|---|
ServerName | 
acquireSplitWALWorker(Procedure<?> procedure)
Acquire a split WAL worker 
 | 
void | 
addUsedSplitWALWorker(ServerName worker)
When master restart, there will be a new splitWorkerAssigner. 
 | 
void | 
archive(String wal)
Archive processed WAL 
 | 
(package private) List<Procedure> | 
createSplitWALProcedures(List<org.apache.hadoop.fs.FileStatus> splittingWALs,
                        ServerName crashedServer)  | 
void | 
deleteWALDir(ServerName serverName)  | 
private org.apache.hadoop.fs.Path | 
getWALSplitDir(ServerName serverName)  | 
List<org.apache.hadoop.fs.FileStatus> | 
getWALsToSplit(ServerName serverName,
              boolean splitMeta)  | 
boolean | 
isSplitWALFinished(String walPath)  | 
void | 
releaseSplitWALWorker(ServerName worker,
                     MasterProcedureScheduler scheduler)
After the worker finished the split WAL task, it will release the worker, and wake up all the
 suspend procedures in the ProcedureEvent 
 | 
List<Procedure> | 
splitWALs(ServerName crashedServer,
         boolean splitMeta)  | 
private static final org.slf4j.Logger LOG
private final MasterServices master
private final SplitWALManager.SplitWorkerAssigner splitWorkerAssigner
private final org.apache.hadoop.fs.Path rootDir
private final org.apache.hadoop.fs.FileSystem fs
private final org.apache.hadoop.conf.Configuration conf
private final org.apache.hadoop.fs.Path walArchiveDir
public SplitWALManager(MasterServices master) throws IOException
IOExceptionpublic List<Procedure> splitWALs(ServerName crashedServer, boolean splitMeta) throws IOException
IOExceptionpublic List<org.apache.hadoop.fs.FileStatus> getWALsToSplit(ServerName serverName, boolean splitMeta) throws IOException
IOExceptionprivate org.apache.hadoop.fs.Path getWALSplitDir(ServerName serverName)
public void archive(String wal) throws IOException
IOExceptionpublic void deleteWALDir(ServerName serverName) throws IOException
IOExceptionpublic boolean isSplitWALFinished(String walPath) throws IOException
IOExceptionList<Procedure> createSplitWALProcedures(List<org.apache.hadoop.fs.FileStatus> splittingWALs, ServerName crashedServer)
public ServerName acquireSplitWALWorker(Procedure<?> procedure) throws ProcedureSuspendedException
procedure - split WAL taskProcedureSuspendedException - if there is no available worker, it will throw this
                                     exception to WAIT the procedure.public void releaseSplitWALWorker(ServerName worker, MasterProcedureScheduler scheduler)
worker - worker which is about to releasescheduler - scheduler which is to wake up the procedure eventpublic void addUsedSplitWALWorker(ServerName worker)
worker - region server which is executing a split WAL taskCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.