Package org.apache.hadoop.hbase.master
Class SplitWALManager
java.lang.Object
org.apache.hadoop.hbase.master.SplitWALManager
Create
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.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.apache.hadoop.conf.Configurationprivate final org.apache.hadoop.fs.FileSystemprivate static final org.slf4j.Loggerprivate final MasterServicesprivate final org.apache.hadoop.fs.Pathprivate final WorkerAssignerprivate final org.apache.hadoop.fs.Path -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacquireSplitWALWorker(Procedure<?> procedure) Acquire a split WAL workervoidaddUsedSplitWALWorker(ServerName worker) When master restart, there will be a new splitWorkerAssigner.voidArchive processed WALcreateSplitWALProcedures(List<org.apache.hadoop.fs.FileStatus> splittingWALs, ServerName crashedServer) voiddeleteWALDir(ServerName serverName) private org.apache.hadoop.fs.PathgetWALSplitDir(ServerName serverName) List<org.apache.hadoop.fs.FileStatus>getWALsToSplit(ServerName serverName, boolean splitMeta) booleanisSplitWALFinished(String walPath) voidreleaseSplitWALWorker(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 ProcedureEventsplitWALs(ServerName crashedServer, boolean splitMeta)
-
Field Details
-
LOG
-
master
-
splitWorkerAssigner
-
rootDir
-
fs
-
conf
-
walArchiveDir
-
-
Constructor Details
-
SplitWALManager
- Throws:
IOException
-
-
Method Details
-
splitWALs
- Throws:
IOException
-
getWALsToSplit
public List<org.apache.hadoop.fs.FileStatus> getWALsToSplit(ServerName serverName, boolean splitMeta) throws IOException - Throws:
IOException
-
getWALSplitDir
-
archive
Archive processed WAL- Throws:
IOException
-
deleteWALDir
- Throws:
IOException
-
isSplitWALFinished
- Throws:
IOException
-
createSplitWALProcedures
List<Procedure> createSplitWALProcedures(List<org.apache.hadoop.fs.FileStatus> splittingWALs, ServerName crashedServer) -
acquireSplitWALWorker
Acquire a split WAL worker- Parameters:
procedure- split WAL task- Returns:
- an available region server which could execute this task
- Throws:
ProcedureSuspendedException- if there is no available worker, it will throw this exception to WAIT the procedure.
-
releaseSplitWALWorker
After the worker finished the split WAL task, it will release the worker, and wake up all the suspend procedures in the ProcedureEvent- Parameters:
worker- worker which is about to releasescheduler- scheduler which is to wake up the procedure event
-
addUsedSplitWALWorker
When master restart, there will be a new splitWorkerAssigner. But if there are splitting WAL tasks running on the region server side, they will not be count by the new splitWorkerAssigner. Thus we should add the workers of running tasks to the assigner when we load the procedures from MasterProcWALs.- Parameters:
worker- region server which is executing a split WAL task
-