You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2018/03/25 21:44:53 UTC

[2/6] helix git commit: Fix Timeout scheduling issue.

Fix Timeout scheduling issue.

If there is no timeout specified in the workflow, it will keep scheduling the rebalancer which trigger events.


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/305add9b
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/305add9b
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/305add9b

Branch: refs/heads/master
Commit: 305add9be0da711c6257e4b0bf82027587b5493b
Parents: 38b9a79
Author: Junkai Xue <jx...@linkedin.com>
Authored: Fri Mar 2 15:51:09 2018 -0800
Committer: dasahcc <ju...@gmail.com>
Committed: Sun Mar 25 14:43:42 2018 -0700

----------------------------------------------------------------------
 .../helix/controller/rebalancer/util/RebalanceScheduler.java    | 3 +++
 .../src/main/java/org/apache/helix/task/TaskRebalancer.java     | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/305add9b/helix-core/src/main/java/org/apache/helix/controller/rebalancer/util/RebalanceScheduler.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/controller/rebalancer/util/RebalanceScheduler.java b/helix-core/src/main/java/org/apache/helix/controller/rebalancer/util/RebalanceScheduler.java
index 81e5d8d..5ddcf4c 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/rebalancer/util/RebalanceScheduler.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/rebalancer/util/RebalanceScheduler.java
@@ -60,6 +60,9 @@ public class RebalanceScheduler {
     }
 
     long delay = startTime - System.currentTimeMillis();
+    if (delay < 0) {
+      LOG.debug(String.format("Delay time is %s, will not be scheduled", delay));
+    }
     LOG.info(
         "Schedule rebalance for resource : " + resource + " at time: " + startTime + " delay: "
             + delay);

http://git-wip-us.apache.org/repos/asf/helix/blob/305add9b/helix-core/src/main/java/org/apache/helix/task/TaskRebalancer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/task/TaskRebalancer.java b/helix-core/src/main/java/org/apache/helix/task/TaskRebalancer.java
index 5e0fe01..e0e9903 100644
--- a/helix-core/src/main/java/org/apache/helix/task/TaskRebalancer.java
+++ b/helix-core/src/main/java/org/apache/helix/task/TaskRebalancer.java
@@ -296,8 +296,9 @@ public abstract class TaskRebalancer implements Rebalancer, MappingCalculator {
       long timeoutPeriod) {
     long nextTimeout = getTimeoutTime(startTime, timeoutPeriod);
     long nextRebalanceTime = _rebalanceScheduler.getRebalanceTime(resourceId);
-    if (nextRebalanceTime == TaskConstants.DEFAULT_NEVER_TIMEOUT
-        || nextTimeout < nextRebalanceTime) {
+    if (nextTimeout >= System.currentTimeMillis() && (
+        nextRebalanceTime == TaskConstants.DEFAULT_NEVER_TIMEOUT
+            || nextTimeout < nextRebalanceTime)) {
       _rebalanceScheduler.scheduleRebalance(_manager, resourceId, nextTimeout);
     }
   }