@InterfaceAudience.Private public class SplitLogWorker extends Object implements Runnable
SplitLogManager
running in the master and races with other workers in other serves to acquire those tasks.
The coordination is done via coordination engine.
If a worker has successfully moved the task from state UNASSIGNED to OWNED then it owns the task. It keeps heart beating the manager by periodically moving the task from UNASSIGNED to OWNED state. On success it moves the task to TASK_DONE. On unrecoverable error it moves task state to ERR. If it cannot continue but wants the master to retry the task then it moves the task state to RESIGNED.
The manager can take a task away from a worker by moving the task from OWNED to UNASSIGNED. In the absence of a global lock there is a unavoidable race here - a worker might have just finished its task when it is stripped of its ownership. Here we rely on the idempotency of the log splitting task for correctness
Modifier and Type | Class and Description |
---|---|
static interface |
SplitLogWorker.TaskExecutor
Objects implementing this interface actually do the task that has been
acquired by a
SplitLogWorker . |
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.conf.Configuration |
conf |
private SplitLogWorkerCoordination |
coordination |
private static org.slf4j.Logger |
LOG |
private RegionServerServices |
server |
(package private) Thread |
worker |
Constructor and Description |
---|
SplitLogWorker(org.apache.hadoop.conf.Configuration conf,
RegionServerServices server,
LastSequenceId sequenceIdChecker,
WALFactory factory) |
SplitLogWorker(Server hserver,
org.apache.hadoop.conf.Configuration conf,
RegionServerServices server,
SplitLogWorker.TaskExecutor splitTaskExecutor) |
Modifier and Type | Method and Description |
---|---|
int |
getTaskReadySeq()
Returns the number of tasks processed by coordination.
|
void |
run() |
(package private) static SplitLogWorker.TaskExecutor.Status |
splitLog(String filename,
CancelableProgressable p,
org.apache.hadoop.conf.Configuration conf,
RegionServerServices server,
LastSequenceId sequenceIdChecker,
WALFactory factory) |
void |
start()
start the SplitLogWorker thread
|
void |
stop()
stop the SplitLogWorker thread
|
void |
stopTask()
If the worker is doing a task i.e.
|
private static final org.slf4j.Logger LOG
private final SplitLogWorkerCoordination coordination
private final org.apache.hadoop.conf.Configuration conf
private final RegionServerServices server
public SplitLogWorker(Server hserver, org.apache.hadoop.conf.Configuration conf, RegionServerServices server, SplitLogWorker.TaskExecutor splitTaskExecutor)
public SplitLogWorker(org.apache.hadoop.conf.Configuration conf, RegionServerServices server, LastSequenceId sequenceIdChecker, WALFactory factory)
static SplitLogWorker.TaskExecutor.Status splitLog(String filename, CancelableProgressable p, org.apache.hadoop.conf.Configuration conf, RegionServerServices server, LastSequenceId sequenceIdChecker, WALFactory factory)
public void stopTask()
public void start()
public void stop()
public int getTaskReadySeq()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.