HBASE-5635 If getTaskList() returns null, splitlogWorker would go down and it won't serve any requests (Ram)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1329322 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b854d1efb1
commit
e2cd675020
|
@ -469,25 +469,31 @@ public class SplitLogWorker extends ZooKeeperListener implements Runnable {
|
||||||
|
|
||||||
|
|
||||||
private List<String> getTaskList() {
|
private List<String> getTaskList() {
|
||||||
for (int i = 0; i < zkretries; i++) {
|
List<String> childrenPaths = null;
|
||||||
|
long sleepTime = 1000;
|
||||||
|
// It will be in loop till it gets the list of children or
|
||||||
|
// it will come out if worker thread exited.
|
||||||
|
while (!exitWorker) {
|
||||||
try {
|
try {
|
||||||
return (ZKUtil.listChildrenAndWatchForNewChildren(this.watcher,
|
childrenPaths = ZKUtil.listChildrenAndWatchForNewChildren(this.watcher,
|
||||||
this.watcher.splitLogZNode));
|
this.watcher.splitLogZNode);
|
||||||
} catch (KeeperException e) {
|
if (childrenPaths != null) {
|
||||||
LOG.warn("Could not get children of znode " +
|
return childrenPaths;
|
||||||
this.watcher.splitLogZNode, e);
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e1) {
|
|
||||||
LOG.warn("Interrupted while trying to get task list ...", e1);
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
} catch (KeeperException e) {
|
||||||
|
LOG.warn("Could not get children of znode "
|
||||||
|
+ this.watcher.splitLogZNode, e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
LOG.debug("Retry listChildren of znode " + this.watcher.splitLogZNode
|
||||||
|
+ " after sleep for " + sleepTime + "ms!");
|
||||||
|
Thread.sleep(sleepTime);
|
||||||
|
} catch (InterruptedException e1) {
|
||||||
|
LOG.warn("Interrupted while trying to get task list ...", e1);
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG.warn("Tried " + zkretries + " times, still couldn't fetch " +
|
return childrenPaths;
|
||||||
"children of " + watcher.splitLogZNode + " giving up");
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue