You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ra...@apache.org on 2012/04/23 18:47:04 UTC
svn commit: r1329322 -
/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/SplitLogWorker.java
Author: ramkrishna
Date: Mon Apr 23 16:47:04 2012
New Revision: 1329322
URL: http://svn.apache.org/viewvc?rev=1329322&view=rev
Log:
HBASE-5635 If getTaskList() returns null, splitlogWorker would go down and it won't serve any requests (Ram)
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/SplitLogWorker.java
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/SplitLogWorker.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/SplitLogWorker.java?rev=1329322&r1=1329321&r2=1329322&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/SplitLogWorker.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/SplitLogWorker.java Mon Apr 23 16:47:04 2012
@@ -469,25 +469,31 @@ public class SplitLogWorker extends ZooK
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 {
- return (ZKUtil.listChildrenAndWatchForNewChildren(this.watcher,
- this.watcher.splitLogZNode));
- } catch (KeeperException e) {
- LOG.warn("Could not get children of znode " +
- 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;
+ childrenPaths = ZKUtil.listChildrenAndWatchForNewChildren(this.watcher,
+ this.watcher.splitLogZNode);
+ if (childrenPaths != null) {
+ return childrenPaths;
}
+ } 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 " +
- "children of " + watcher.splitLogZNode + " giving up");
- return null;
+ return childrenPaths;
}