HBASE-5618 SplitLogManager - prevent unnecessary attempts to resubmits

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1310923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-04-07 23:32:28 +00:00
parent 00781a6eb1
commit 2f06c667d3
1 changed files with 17 additions and 2 deletions

View File

@ -539,6 +539,7 @@ public class SplitLogManager extends ZooKeeperListener {
version) == false) {
LOG.debug("failed to resubmit task " + path +
" version changed");
task.heartbeatNoDetails(EnvironmentEdgeManager.currentTimeMillis());
return false;
}
} catch (NoNodeException e) {
@ -546,6 +547,11 @@ public class SplitLogManager extends ZooKeeperListener {
" task done (or forced done by removing the znode)");
getDataSetWatchSuccess(path, null, Integer.MIN_VALUE);
return false;
} catch (KeeperException.BadVersionException e) {
LOG.debug("failed to resubmit task " + path +
" version changed");
task.heartbeatNoDetails(EnvironmentEdgeManager.currentTimeMillis());
return false;
} catch (KeeperException e) {
tot_mgr_resubmit_failed.incrementAndGet();
LOG.warn("failed to resubmit " + path, e);
@ -716,7 +722,12 @@ public class SplitLogManager extends ZooKeeperListener {
@Override
public void nodeDataChanged(String path) {
if (tasks.get(path) != null || ZKSplitLog.isRescanNode(watcher, path)) {
Task task;
task = tasks.get(path);
if (task != null || ZKSplitLog.isRescanNode(watcher, path)) {
if (task != null) {
task.heartbeatNoDetails(EnvironmentEdgeManager.currentTimeMillis());
}
getDataSetWatch(path, zkretries);
}
}
@ -812,7 +823,11 @@ public class SplitLogManager extends ZooKeeperListener {
}
public boolean isUnassigned() {
return (last_update == -1);
return (cur_worker_name == null);
}
public void heartbeatNoDetails(long time) {
last_update = time;
}
public void heartbeat(long time, int version, String worker) {