@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
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
SplitLogWorker.TaskExecutor
Objects implementing this interface actually do the task that has been
acquired by a
SplitLogWorker. |
| 构造器和说明 |
|---|
SplitLogWorker(Server hserver,
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) |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
getTaskReadySeq()
Returns the number of tasks processed by coordination.
|
void |
run() |
void |
start()
start the SplitLogWorker thread
|
void |
stop()
stop the SplitLogWorker thread
|
void |
stopTask()
If the worker is doing a task i.e. splitting a log file then stop the task.
|
public SplitLogWorker(Server hserver, org.apache.hadoop.conf.Configuration conf, RegionServerServices server, SplitLogWorker.TaskExecutor splitTaskExecutor)
public SplitLogWorker(Server hserver, 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–2019 The Apache Software Foundation. All rights reserved.