@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.| Constructor and Description |
|---|
SplitWALManager(MasterServices master) |
| Modifier and Type | Method and Description |
|---|---|
ServerName |
acquireSplitWALWorker(Procedure<?> procedure)
try to acquire an worker from online servers which is executring
|
void |
addUsedSplitWALWorker(ServerName worker)
When master restart, there will be a new splitWorkerAssigner.
|
void |
deleteSplitWAL(String wal) |
void |
deleteWALDir(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) |
public SplitWALManager(MasterServices master)
public List<Procedure> splitWALs(ServerName crashedServer, boolean splitMeta) throws IOException
IOExceptionpublic List<org.apache.hadoop.fs.FileStatus> getWALsToSplit(ServerName serverName, boolean splitMeta) throws IOException
IOExceptionpublic void deleteSplitWAL(String wal) throws IOException
IOExceptionpublic void deleteWALDir(ServerName serverName) throws IOException
IOExceptionpublic boolean isSplitWALFinished(String walPath) throws IOException
IOExceptionpublic ServerName acquireSplitWALWorker(Procedure<?> procedure) throws ProcedureSuspendedException
procedure - split WAL taskProcedureSuspendedException - if there is no available worker,
it will throw this exception to let the procedure waitpublic 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–2019 The Apache Software Foundation. All rights reserved.