@InterfaceAudience.Private public class SplitLogWorker extends ZooKeeperListener implements Runnable
SplitLogManager
running in the master and races with other workers
in other serves to acquire those tasks. The coordination is done via
zookeeper. All the action takes place at /hbase/splitlog znode.
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 . |
watcher
Constructor and Description |
---|
SplitLogWorker(ZooKeeperWatcher watcher,
org.apache.hadoop.conf.Configuration conf,
RegionServerServices server,
LastSequenceId sequenceIdChecker) |
SplitLogWorker(ZooKeeperWatcher watcher,
org.apache.hadoop.conf.Configuration conf,
RegionServerServices server,
SplitLogWorker.TaskExecutor splitTaskExecutor) |
SplitLogWorker(ZooKeeperWatcher watcher,
org.apache.hadoop.conf.Configuration conf,
ServerName serverName,
SplitLogWorker.TaskExecutor splitTaskExecutor) |
Modifier and Type | Method and Description |
---|---|
void |
nodeChildrenChanged(String path)
Called when an existing node has a child node added or removed.
|
void |
nodeDataChanged(String path)
Called when an existing node has changed data.
|
void |
run() |
void |
start()
start the SplitLogWorker thread
|
void |
stop()
stop the SplitLogWorker thread
|
nodeCreated, nodeDeleted
public SplitLogWorker(ZooKeeperWatcher watcher, org.apache.hadoop.conf.Configuration conf, RegionServerServices server, SplitLogWorker.TaskExecutor splitTaskExecutor)
public SplitLogWorker(ZooKeeperWatcher watcher, org.apache.hadoop.conf.Configuration conf, ServerName serverName, SplitLogWorker.TaskExecutor splitTaskExecutor)
public SplitLogWorker(ZooKeeperWatcher watcher, org.apache.hadoop.conf.Configuration conf, RegionServerServices server, LastSequenceId sequenceIdChecker)
public void nodeDataChanged(String path)
ZooKeeperListener
nodeDataChanged
in class ZooKeeperListener
path
- full path of the updated nodepublic void nodeChildrenChanged(String path)
ZooKeeperListener
nodeChildrenChanged
in class ZooKeeperListener
path
- full path of the node whose children have changedpublic void start()
public void stop()
Copyright © 2013 The Apache Software Foundation. All rights reserved.