Class ZKSplitLogManagerCoordination
java.lang.Object
org.apache.hadoop.hbase.zookeeper.ZKListener
org.apache.hadoop.hbase.coordination.ZKSplitLogManagerCoordination
- All Implemented Interfaces:
- SplitLogManagerCoordination
@Private
public class ZKSplitLogManagerCoordination
extends ZKListener
implements SplitLogManagerCoordination
ZooKeeper based implementation of 
SplitLogManagerCoordination- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionclassAsynchronous handler for zk create node results.classAsynchronous handler for zk create RESCAN-node results.classAsynchronous handler for zk delete node results.classAsynchronous handler for zk get-data-set-watch on node results.static interfaceSplitLogManagercan use objects implementing this interface to finish off a partially done task bySplitLogWorker.Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.coordination.SplitLogManagerCoordinationSplitLogManagerCoordination.SplitLogManagerDetails
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final org.apache.hadoop.conf.Configurationstatic final intstatic final intstatic final int(package private) SplitLogManagerCoordination.SplitLogManagerDetailsbooleanprivate static final org.slf4j.Loggerprivate longprivate final ZKSplitLogManagerCoordination.TaskFinisherprivate longprivate longFields inherited from class org.apache.hadoop.hbase.zookeeper.ZKListenerwatcher
- 
Constructor SummaryConstructorsConstructorDescriptionZKSplitLogManagerCoordination(org.apache.hadoop.conf.Configuration conf, ZKWatcher watcher) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidtells Coordination that it should check for new tasksvoidCheck that the task is still thereprivate voidcreateNode(String path, Long retry_count) private voidcreateNodeFailure(String path) private voidcreateNodeSuccess(String path) private voidprivate voidcreateRescanSuccess(String path) private voiddeleteNode(String path, Long retries) private voiddeleteNodeFailure(String path) private voiddeleteNodeSuccess(String path) voiddeleteTask(String path) private SplitLogManager.TaskfindOrCreateOrphanTask(String path) private voidgetDataSetWatch(String path, Long retry_count) private voidgetDataSetWatchFailure(String path) private voidgetDataSetWatchSuccess(String path, byte[] data, int version) Returns the configuration that was provided previouslyprivate voidhandleUnassignedTask(String path) It is possible for a task to stay in UNASSIGNED state indefinitely - say SplitLogManager wants to resubmit a task.private voidheartbeat(String path, int new_version, ServerName workerName) voidinit()Support method to init constants such as timeout.private voidprivate booleanneedAbandonRetries(int statusCode, String action) Helper function to check whether to abandon retries in ZooKeeper AsyncCallback functionsvoidnodeDataChanged(String path) Called when an existing node has changed data.prepareTask(String taskname) Prepare the new taskintReturn the number of remaining tasksprivate voidrescan(long retries) signal the workers that a task was resubmitted by creating the RESCAN node.private booleanprivate voidresubmitOrFail(String path, SplitLogManager.ResubmitDirective directive) booleanresubmitTask(String path, SplitLogManager.Task task, SplitLogManager.ResubmitDirective directive) Resubmit the task in case if found unassigned or failedvoidProvide the configuration from the SplitLogManagerprivate voidsetDone(String path, SplitLogManager.TerminationStatus status) voidsetIgnoreDeleteForTesting(boolean b) Temporary function that is used by unit tests onlyvoidsubmitTask(String path) Methods inherited from class org.apache.hadoop.hbase.zookeeper.ZKListenergetWatcher, nodeChildrenChanged, nodeCreated, nodeDeleted
- 
Field Details- 
DEFAULT_TIMEOUT- See Also:
 
- 
DEFAULT_ZK_RETRIES- See Also:
 
- 
DEFAULT_MAX_RESUBMIT- See Also:
 
- 
LOG
- 
taskFinisher
- 
conf
- 
zkretries
- 
resubmitThreshold
- 
timeout
- 
details
- 
ignoreZKDeleteForTesting
 
- 
- 
Constructor Details- 
ZKSplitLogManagerCoordination
 
- 
- 
Method Details- 
initDescription copied from interface:SplitLogManagerCoordinationSupport method to init constants such as timeout. Mostly required for UTs.- Specified by:
- initin interface- SplitLogManagerCoordination
- Throws:
- IOException
 
- 
prepareTaskDescription copied from interface:SplitLogManagerCoordinationPrepare the new task- Specified by:
- prepareTaskin interface- SplitLogManagerCoordination
- Parameters:
- taskname- name of the task
- Returns:
- the task id
 
- 
remainingTasksInCoordinationDescription copied from interface:SplitLogManagerCoordinationReturn the number of remaining tasks- Specified by:
- remainingTasksInCoordinationin interface- SplitLogManagerCoordination
 
- 
handleUnassignedTaskIt is possible for a task to stay in UNASSIGNED state indefinitely - say SplitLogManager wants to resubmit a task. It forces the task to UNASSIGNED state but it dies before it could create the RESCAN task node to signal the SplitLogWorkers to pick up the task. To prevent this scenario the SplitLogManager resubmits all orphan and UNASSIGNED tasks at startup.
- 
deleteTask- Specified by:
- deleteTaskin interface- SplitLogManagerCoordination
- Parameters:
- path- to be removed
 
- 
resubmitTaskpublic boolean resubmitTask(String path, SplitLogManager.Task task, SplitLogManager.ResubmitDirective directive) Description copied from interface:SplitLogManagerCoordinationResubmit the task in case if found unassigned or failed- Specified by:
- resubmitTaskin interface- SplitLogManagerCoordination
- Parameters:
- path- path related to task
- task- to resubmit
- directive- whether it should be forced
- Returns:
- whether it was successful
 
- 
checkTasksDescription copied from interface:SplitLogManagerCoordinationtells Coordination that it should check for new tasks- Specified by:
- checkTasksin interface- SplitLogManagerCoordination
 
- 
rescansignal the workers that a task was resubmitted by creating the RESCAN node.
- 
submitTask- Specified by:
- submitTaskin interface- SplitLogManagerCoordination
- Parameters:
- path- to be submitted
 
- 
checkTaskStillAvailableDescription copied from interface:SplitLogManagerCoordinationCheck that the task is still there- Specified by:
- checkTaskStillAvailablein interface- SplitLogManagerCoordination
- Parameters:
- path- node to check
 
- 
deleteNode
- 
deleteNodeSuccess
- 
deleteNodeFailure
- 
createRescanSuccess
- 
createRescanFailure
- 
needAbandonRetriesHelper function to check whether to abandon retries in ZooKeeper AsyncCallback functions- Parameters:
- statusCode- integer value of a ZooKeeper exception code
- action- description message about the retried action
- Returns:
- true when need to abandon retries otherwise false
 
- 
createNode
- 
createNodeSuccess
- 
createNodeFailure
- 
getDataSetWatch
- 
getDataSetWatchSuccessprivate void getDataSetWatchSuccess(String path, byte[] data, int version) throws DeserializationException - Throws:
- DeserializationException
 
- 
resubmitOrFail
- 
getDataSetWatchFailure
- 
setDone
- 
findOrCreateOrphanTask
- 
heartbeat
- 
lookForOrphans
- 
nodeDataChangedDescription copied from class:ZKListenerCalled when an existing node has changed data.- Overrides:
- nodeDataChangedin class- ZKListener
- Parameters:
- path- full path of the updated node
 
- 
resubmit
- 
setDetailsDescription copied from interface:SplitLogManagerCoordinationProvide the configuration from the SplitLogManager- Specified by:
- setDetailsin interface- SplitLogManagerCoordination
 
- 
getDetailsDescription copied from interface:SplitLogManagerCoordinationReturns the configuration that was provided previously- Specified by:
- getDetailsin interface- SplitLogManagerCoordination
 
- 
setIgnoreDeleteForTestingTemporary function that is used by unit tests only
 
-