helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject git commit: [HELIX-506] Ensure that tasks are not placed on targets with pending states
Date Tue, 26 Aug 2014 23:12:02 GMT
Repository: helix
Updated Branches:
  refs/heads/master bfe5d2d7e -> 59b4bbb0b


[HELIX-506] Ensure that tasks are not placed on targets with pending states


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

Branch: refs/heads/master
Commit: 59b4bbb0b4f45b8b8d350a3dac43748dc52a5b5b
Parents: bfe5d2d
Author: Kanak Biscuitwala <kanak@apache.org>
Authored: Tue Aug 26 11:02:10 2014 -0700
Committer: Kanak Biscuitwala <kanak@apache.org>
Committed: Tue Aug 26 16:11:40 2014 -0700

----------------------------------------------------------------------
 .../java/org/apache/helix/task/FixedTargetTaskRebalancer.java | 6 ++++++
 .../java/org/apache/helix/task/GenericTaskRebalancer.java     | 7 +++++++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/59b4bbb0/helix-core/src/main/java/org/apache/helix/task/FixedTargetTaskRebalancer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/task/FixedTargetTaskRebalancer.java
b/helix-core/src/main/java/org/apache/helix/task/FixedTargetTaskRebalancer.java
index 3d6f2eb..46f0f3b 100644
--- a/helix-core/src/main/java/org/apache/helix/task/FixedTargetTaskRebalancer.java
+++ b/helix-core/src/main/java/org/apache/helix/task/FixedTargetTaskRebalancer.java
@@ -147,6 +147,12 @@ public class FixedTargetTaskRebalancer extends TaskRebalancer {
       int pId = partitions.get(0);
       if (includeSet.contains(pId)) {
         for (ParticipantId instance : instances) {
+          State pending =
+              currStateOutput.getPendingState(ResourceId.from(tgtIs.getResourceName()),
+                  PartitionId.from(pName), instance);
+          if (pending != null) {
+            continue;
+          }
           State s =
               currStateOutput.getCurrentState(ResourceId.from(tgtIs.getResourceName()),
                   PartitionId.from(pName), instance);

http://git-wip-us.apache.org/repos/asf/helix/blob/59b4bbb0/helix-core/src/main/java/org/apache/helix/task/GenericTaskRebalancer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/task/GenericTaskRebalancer.java b/helix-core/src/main/java/org/apache/helix/task/GenericTaskRebalancer.java
index 740b1b9..d7ecc5c 100644
--- a/helix-core/src/main/java/org/apache/helix/task/GenericTaskRebalancer.java
+++ b/helix-core/src/main/java/org/apache/helix/task/GenericTaskRebalancer.java
@@ -190,9 +190,16 @@ public class GenericTaskRebalancer extends TaskRebalancer {
       Map<ParticipantId, State> stateMap =
           currStateOutput.getCurrentStateMap(ResourceId.from(targetResource),
               PartitionId.from(partition));
+      Map<ParticipantId, State> pendingStateMap =
+          currStateOutput.getPendingStateMap(ResourceId.from(targetResource),
+              PartitionId.from(partition));
       for (Map.Entry<ParticipantId, State> e : stateMap.entrySet()) {
         ParticipantId instanceName = e.getKey();
         State state = e.getValue();
+        State pending = pendingStateMap.get(instanceName);
+        if (pending != null) {
+          continue;
+        }
         if (targetStates == null || targetStates.isEmpty()
             || targetStates.contains(state.toString())) {
           eligibleInstances.add(instanceName);


Mime
View raw message