@InterfaceAudience.Private public class ZKSplitLogManagerCoordination extends ZKListener implements SplitLogManagerCoordination
SplitLogManagerCoordination| Modifier and Type | Class and Description | 
|---|---|
| class  | ZKSplitLogManagerCoordination.CreateAsyncCallbackAsynchronous handler for zk create node results. | 
| class  | ZKSplitLogManagerCoordination.CreateRescanAsyncCallbackAsynchronous handler for zk create RESCAN-node results. | 
| class  | ZKSplitLogManagerCoordination.DeleteAsyncCallbackAsynchronous handler for zk delete node results. | 
| class  | ZKSplitLogManagerCoordination.GetDataAsyncCallbackAsynchronous handler for zk get-data-set-watch on node results. | 
| static interface  | ZKSplitLogManagerCoordination.TaskFinisherSplitLogManagercan use objects implementing this
 interface to finish off a partially done task bySplitLogWorker. | 
SplitLogManagerCoordination.SplitLogManagerDetails| Modifier and Type | Field and Description | 
|---|---|
| private org.apache.hadoop.conf.Configuration | conf | 
| static int | DEFAULT_MAX_RESUBMIT | 
| static int | DEFAULT_TIMEOUT | 
| static int | DEFAULT_ZK_RETRIES | 
| (package private) SplitLogManagerCoordination.SplitLogManagerDetails | details | 
| boolean | ignoreZKDeleteForTesting | 
| private static org.slf4j.Logger | LOG | 
| private long | resubmitThreshold | 
| private ZKSplitLogManagerCoordination.TaskFinisher | taskFinisher | 
| private long | timeout | 
| private long | zkretries | 
watcher| Constructor and Description | 
|---|
| ZKSplitLogManagerCoordination(org.apache.hadoop.conf.Configuration conf,
                             ZKWatcher watcher) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | checkTasks()tells Coordination that it should check for new tasks | 
| void | checkTaskStillAvailable(String path)Check that the task is still there | 
| private void | createNode(String path,
          Long retry_count) | 
| private void | createNodeFailure(String path) | 
| private void | createNodeSuccess(String path) | 
| private void | createRescanFailure() | 
| private void | createRescanSuccess(String path) | 
| private void | deleteNode(String path,
          Long retries) | 
| private void | deleteNodeFailure(String path) | 
| private void | deleteNodeSuccess(String path) | 
| void | deleteTask(String path) | 
| private SplitLogManager.Task | findOrCreateOrphanTask(String path) | 
| private void | getDataSetWatch(String path,
               Long retry_count) | 
| private void | getDataSetWatchFailure(String path) | 
| private void | getDataSetWatchSuccess(String path,
                      byte[] data,
                      int version) | 
| SplitLogManagerCoordination.SplitLogManagerDetails | getDetails()Returns the configuration that was provided previously | 
| private void | handleUnassignedTask(String path)It is possible for a task to stay in UNASSIGNED state indefinitely - say SplitLogManager wants
 to resubmit a task. | 
| private void | heartbeat(String path,
         int new_version,
         ServerName workerName) | 
| void | init()Support method to init constants such as timeout. | 
| private void | lookForOrphans() | 
| private boolean | needAbandonRetries(int statusCode,
                  String action)Helper function to check whether to abandon retries in ZooKeeper AsyncCallback functions | 
| void | nodeDataChanged(String path)Called when an existing node has changed data. | 
| String | prepareTask(String taskname)Prepare the new task | 
| int | remainingTasksInCoordination()Return the number of remaining tasks | 
| private void | rescan(long retries)signal the workers that a task was resubmitted by creating the RESCAN node. | 
| private boolean | resubmit(String path,
        int version) | 
| private void | resubmitOrFail(String path,
              SplitLogManager.ResubmitDirective directive) | 
| boolean | resubmitTask(String path,
            SplitLogManager.Task task,
            SplitLogManager.ResubmitDirective directive)Resubmit the task in case if found unassigned or failed | 
| void | setDetails(SplitLogManagerCoordination.SplitLogManagerDetails details)Provide the configuration from the SplitLogManager | 
| private void | setDone(String path,
       SplitLogManager.TerminationStatus status) | 
| void | setIgnoreDeleteForTesting(boolean b)Temporary function that is used by unit tests only | 
| void | submitTask(String path) | 
getWatcher, nodeChildrenChanged, nodeCreated, nodeDeletedpublic static final int DEFAULT_TIMEOUT
public static final int DEFAULT_ZK_RETRIES
public static final int DEFAULT_MAX_RESUBMIT
private static final org.slf4j.Logger LOG
private final ZKSplitLogManagerCoordination.TaskFinisher taskFinisher
private final org.apache.hadoop.conf.Configuration conf
private long zkretries
private long resubmitThreshold
private long timeout
public boolean ignoreZKDeleteForTesting
public ZKSplitLogManagerCoordination(org.apache.hadoop.conf.Configuration conf, ZKWatcher watcher)
public void init() throws IOException
SplitLogManagerCoordinationinit in interface SplitLogManagerCoordinationIOExceptionpublic String prepareTask(String taskname)
SplitLogManagerCoordinationprepareTask in interface SplitLogManagerCoordinationtaskname - name of the taskpublic int remainingTasksInCoordination()
SplitLogManagerCoordinationremainingTasksInCoordination in interface SplitLogManagerCoordinationprivate void handleUnassignedTask(String path)
path - public void deleteTask(String path)
deleteTask in interface SplitLogManagerCoordinationpath - to be removedpublic boolean resubmitTask(String path, SplitLogManager.Task task, SplitLogManager.ResubmitDirective directive)
SplitLogManagerCoordinationresubmitTask in interface SplitLogManagerCoordinationpath - path related to tasktask - to resubmitdirective - whether it should be forcedpublic void checkTasks()
SplitLogManagerCoordinationcheckTasks in interface SplitLogManagerCoordinationprivate void rescan(long retries)
public void submitTask(String path)
submitTask in interface SplitLogManagerCoordinationpath - to be submittedpublic void checkTaskStillAvailable(String path)
SplitLogManagerCoordinationcheckTaskStillAvailable in interface SplitLogManagerCoordinationpath - node to checkprivate void deleteNode(String path, Long retries)
private void deleteNodeSuccess(String path)
private void deleteNodeFailure(String path)
private void createRescanSuccess(String path)
private void createRescanFailure()
private boolean needAbandonRetries(int statusCode, String action)
statusCode - integer value of a ZooKeeper exception codeaction - description message about the retried actionprivate void createNode(String path, Long retry_count)
private void createNodeSuccess(String path)
private void createNodeFailure(String path)
private void getDataSetWatch(String path, Long retry_count)
private void getDataSetWatchSuccess(String path, byte[] data, int version) throws DeserializationException
DeserializationExceptionprivate void resubmitOrFail(String path, SplitLogManager.ResubmitDirective directive)
private void getDataSetWatchFailure(String path)
private void setDone(String path, SplitLogManager.TerminationStatus status)
private SplitLogManager.Task findOrCreateOrphanTask(String path)
private void heartbeat(String path, int new_version, ServerName workerName)
private void lookForOrphans()
public void nodeDataChanged(String path)
ZKListenernodeDataChanged in class ZKListenerpath - full path of the updated nodepublic void setDetails(SplitLogManagerCoordination.SplitLogManagerDetails details)
SplitLogManagerCoordinationsetDetails in interface SplitLogManagerCoordinationpublic SplitLogManagerCoordination.SplitLogManagerDetails getDetails()
SplitLogManagerCoordinationgetDetails in interface SplitLogManagerCoordinationpublic void setIgnoreDeleteForTesting(boolean b)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.