helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject git commit: [HELIX-492] Task should be its own rebalance mode
Date Mon, 04 Aug 2014 21:41:39 GMT
Repository: helix
Updated Branches:
  refs/heads/master 593918880 -> dd8226b83


[HELIX-492] Task should be its own rebalance mode


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

Branch: refs/heads/master
Commit: dd8226b8365c59ab44aa49eec6fd116f757bfbd2
Parents: 5939188
Author: Kanak Biscuitwala <kanak@apache.org>
Authored: Mon Aug 4 14:41:28 2014 -0700
Committer: Kanak Biscuitwala <kanak@apache.org>
Committed: Mon Aug 4 14:41:28 2014 -0700

----------------------------------------------------------------------
 .../java/org/apache/helix/model/IdealState.java    | 17 ++++++++++++-----
 .../java/org/apache/helix/task/TaskDriver.java     |  2 +-
 2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/dd8226b8/helix-core/src/main/java/org/apache/helix/model/IdealState.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/IdealState.java b/helix-core/src/main/java/org/apache/helix/model/IdealState.java
index b0347ef..e4c2612 100644
--- a/helix-core/src/main/java/org/apache/helix/model/IdealState.java
+++ b/helix-core/src/main/java/org/apache/helix/model/IdealState.java
@@ -45,6 +45,8 @@ import org.apache.helix.controller.rebalancer.FullAutoRebalancer;
 import org.apache.helix.controller.rebalancer.HelixRebalancer;
 import org.apache.helix.controller.rebalancer.RebalancerRef;
 import org.apache.helix.controller.rebalancer.SemiAutoRebalancer;
+import org.apache.helix.task.FixedTargetTaskRebalancer;
+import org.apache.helix.task.GenericTaskRebalancer;
 import org.apache.log4j.Logger;
 
 import com.google.common.base.Enums;
@@ -105,6 +107,7 @@ public class IdealState extends HelixProperty {
     SEMI_AUTO,
     CUSTOMIZED,
     USER_DEFINED,
+    TASK,
     NONE
   }
 
@@ -307,8 +310,8 @@ public class IdealState extends HelixProperty {
     case FULL_AUTO:
       return _record.getListFields().keySet();
     case CUSTOMIZED:
-      return _record.getMapFields().keySet();
     case USER_DEFINED:
+    case TASK:
       return _record.getMapFields().keySet();
     default:
       logger.error("Invalid ideal state mode:" + getResourceName());
@@ -395,7 +398,7 @@ public class IdealState extends HelixProperty {
         return Collections.emptySet();
       }
     } else if (rebalanceMode == RebalanceMode.CUSTOMIZED
-        || rebalanceMode == RebalanceMode.USER_DEFINED) {
+        || rebalanceMode == RebalanceMode.USER_DEFINED || rebalanceMode == RebalanceMode.TASK)
{
       // get instances from map fields
       Map<String, String> stateMap = _record.getMapField(partitionName);
       if (stateMap != null) {
@@ -734,10 +737,14 @@ public class IdealState extends HelixProperty {
       property = RebalanceMode.CUSTOMIZED;
       break;
     default:
-      if (getRebalancerClassName() != null) {
-        property = RebalanceMode.USER_DEFINED;
-      } else {
+      String rebalancerName = getRebalancerClassName();
+      if (rebalancerName == null) {
         property = RebalanceMode.SEMI_AUTO;
+      } else if (rebalancerName.equals(FixedTargetTaskRebalancer.class.getName())
+          || rebalancerName.equals(GenericTaskRebalancer.class.getName())) {
+        property = RebalanceMode.TASK;
+      } else {
+        property = RebalanceMode.USER_DEFINED;
       }
       break;
     }

http://git-wip-us.apache.org/repos/asf/helix/blob/dd8226b8/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java b/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
index e4871b5..6f4cc24 100644
--- a/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
+++ b/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
@@ -190,7 +190,7 @@ public class TaskDriver {
 
     // Push out new ideal state based on number of target partitions
     CustomModeISBuilder builder = new CustomModeISBuilder(jobResource);
-    builder.setRebalancerMode(IdealState.RebalanceMode.USER_DEFINED);
+    builder.setRebalancerMode(IdealState.RebalanceMode.TASK);
     builder.setNumReplica(1);
     builder.setNumPartitions(numPartitions);
     builder.setStateModel(TaskConstants.STATE_MODEL_NAME);


Mime
View raw message