@InterfaceAudience.Private public class ZKSplitLogManagerCoordination extends ZooKeeperListener implements SplitLogManagerCoordination
SplitLogManagerCoordination
Modifier and Type | Class and Description |
---|---|
class |
ZKSplitLogManagerCoordination.CreateAsyncCallback
Asynchronous handler for zk create node results.
|
class |
ZKSplitLogManagerCoordination.CreateRescanAsyncCallback
Asynchronous handler for zk create RESCAN-node results.
|
class |
ZKSplitLogManagerCoordination.DeleteAsyncCallback
Asynchronous handler for zk delete node results.
|
class |
ZKSplitLogManagerCoordination.GetDataAsyncCallback
Asynchronous handler for zk get-data-set-watch on node results.
|
static interface |
ZKSplitLogManagerCoordination.TaskFinisher
SplitLogManager can use
objects implementing this interface to finish off a partially
done task by SplitLogWorker . |
static class |
ZKSplitLogManagerCoordination.ZkSplitLogManagerDetails |
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 boolean |
isDrainingDone |
private long |
lastRecoveringNodeCreationTime |
private static org.apache.commons.logging.Log |
LOG |
private org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.SplitLogTask.RecoveryMode |
recoveryMode |
private long |
resubmitThreshold |
private Server |
server |
private ZKSplitLogManagerCoordination.TaskFinisher |
taskFinisher |
private long |
timeout |
private long |
zkretries |
watcher
Constructor and Description |
---|
ZKSplitLogManagerCoordination(CoordinatedStateManager manager,
ZooKeeperWatcher 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) |
(package 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
|
long |
getLastRecoveryTime() |
org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.SplitLogTask.RecoveryMode |
getRecoveryMode()
Temporary function, mostly for UTs.
|
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 boolean |
isDistributedLogReplay(org.apache.hadoop.conf.Configuration conf)
Returns if distributed log replay is turned on or not
|
boolean |
isReplaying() |
boolean |
isSplitting() |
private List<String> |
listSplitLogTasks() |
private void |
lookForOrphans() |
void |
markRegionsRecovering(ServerName serverName,
Set<HRegionInfo> userRegions)
Create znodes /hbase/recovering-regions/[region_ids...]/[failed region server names ...] for
all regions of the passed in region servers
|
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
|
void |
removeRecoveringRegions(Set<String> recoveredServerNameSet,
Boolean isMetaRecovery)
It removes recovering regions under /hbase/recovering-regions/[encoded region name] so that the
region server hosting the region can allow reads to the recovered region
|
void |
removeStaleRecoveringRegions(Set<String> knownFailedServers)
ZooKeeper implementation of
SplitLogManagerCoordination.removeStaleRecoveringRegions(Set) |
private void |
rescan(long retries)
signal the workers that a task was resubmitted by creating the RESCAN node.
|
private boolean |
resubmit(ServerName serverName,
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 |
setRecoveryMode(boolean isForInitialization)
This function is to set recovery mode from outstanding split log tasks from before or current
configuration setting
|
void |
submitTask(String path) |
getWatcher, nodeChildrenChanged, nodeCreated, nodeDeleted
public static final int DEFAULT_TIMEOUT
public static final int DEFAULT_ZK_RETRIES
public static final int DEFAULT_MAX_RESUBMIT
private static final org.apache.commons.logging.Log LOG
private Server server
private long zkretries
private long resubmitThreshold
private long timeout
private ZKSplitLogManagerCoordination.TaskFinisher taskFinisher
SplitLogManagerCoordination.SplitLogManagerDetails details
private volatile long lastRecoveringNodeCreationTime
private org.apache.hadoop.conf.Configuration conf
public boolean ignoreZKDeleteForTesting
private org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.SplitLogTask.RecoveryMode recoveryMode
private boolean isDrainingDone
public ZKSplitLogManagerCoordination(CoordinatedStateManager manager, ZooKeeperWatcher watcher)
public void init() throws IOException
SplitLogManagerCoordination
init
in interface SplitLogManagerCoordination
IOException
public String prepareTask(String taskname)
SplitLogManagerCoordination
prepareTask
in interface SplitLogManagerCoordination
taskname
- name of the taskpublic int remainingTasksInCoordination()
SplitLogManagerCoordination
remainingTasksInCoordination
in interface SplitLogManagerCoordination
private void handleUnassignedTask(String path)
path
- public void deleteTask(String path)
deleteTask
in interface SplitLogManagerCoordination
path
- to be removedpublic boolean resubmitTask(String path, SplitLogManager.Task task, SplitLogManager.ResubmitDirective directive)
SplitLogManagerCoordination
resubmitTask
in interface SplitLogManagerCoordination
path
- path related to tasktask
- to resubmitdirective
- whether it should be forcedpublic void checkTasks()
SplitLogManagerCoordination
checkTasks
in interface SplitLogManagerCoordination
private void rescan(long retries)
public void submitTask(String path)
submitTask
in interface SplitLogManagerCoordination
path
- to be submittedpublic void checkTaskStillAvailable(String path)
SplitLogManagerCoordination
checkTaskStillAvailable
in interface SplitLogManagerCoordination
path
- node to checkpublic void removeRecoveringRegions(Set<String> recoveredServerNameSet, Boolean isMetaRecovery) throws IOException
removeRecoveringRegions
in interface SplitLogManagerCoordination
recoveredServerNameSet
- servers which are just recoveredisMetaRecovery
- whether current recovery is for the meta region on
serverNames
IOException
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 createNodeSuccess(String path)
private void createNodeFailure(String path)
private void getDataSetWatchSuccess(String path, byte[] data, int version) throws DeserializationException
DeserializationException
private void resubmitOrFail(String path, SplitLogManager.ResubmitDirective directive)
private void getDataSetWatchFailure(String path)
private void setDone(String path, SplitLogManager.TerminationStatus status)
SplitLogManager.Task findOrCreateOrphanTask(String path)
private void heartbeat(String path, int new_version, ServerName workerName)
private void lookForOrphans()
public void markRegionsRecovering(ServerName serverName, Set<HRegionInfo> userRegions) throws IOException, InterruptedIOException
markRegionsRecovering
in interface SplitLogManagerCoordination
serverName
- the name of a region serveruserRegions
- user regiones assigned on the region serverIOException
- in case of failureInterruptedIOException
public void nodeDataChanged(String path)
ZooKeeperListener
nodeDataChanged
in class ZooKeeperListener
path
- full path of the updated nodepublic void removeStaleRecoveringRegions(Set<String> knownFailedServers) throws IOException, InterruptedIOException
SplitLogManagerCoordination.removeStaleRecoveringRegions(Set)
removeStaleRecoveringRegions
in interface SplitLogManagerCoordination
knownFailedServers
- set of previously failed serversIOException
- in case of failureInterruptedIOException
public boolean isReplaying()
isReplaying
in interface SplitLogManagerCoordination
public boolean isSplitting()
isSplitting
in interface SplitLogManagerCoordination
private List<String> listSplitLogTasks() throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperException
public void setRecoveryMode(boolean isForInitialization) throws IOException
setRecoveryMode
in interface SplitLogManagerCoordination
isForInitialization
- IOException
InterruptedIOException
private boolean isDistributedLogReplay(org.apache.hadoop.conf.Configuration conf)
conf
- private boolean resubmit(ServerName serverName, String path, int version)
public void setDetails(SplitLogManagerCoordination.SplitLogManagerDetails details)
SplitLogManagerCoordination
setDetails
in interface SplitLogManagerCoordination
public SplitLogManagerCoordination.SplitLogManagerDetails getDetails()
SplitLogManagerCoordination
getDetails
in interface SplitLogManagerCoordination
public org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.SplitLogTask.RecoveryMode getRecoveryMode()
SplitLogManagerCoordination
getRecoveryMode
in interface SplitLogManagerCoordination
public long getLastRecoveryTime()
getLastRecoveryTime
in interface SplitLogManagerCoordination
public void setIgnoreDeleteForTesting(boolean b)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.