helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject git commit: [HELIX-248] More IdealState/RebalancerContext compatibility
Date Mon, 30 Sep 2013 18:20:31 GMT
Updated Branches:
  refs/heads/helix-logical-model 5e2fc9352 -> 416ae8fbc


[HELIX-248] More IdealState/RebalancerContext compatibility


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

Branch: refs/heads/helix-logical-model
Commit: 416ae8fbc33d290a67ee6ba00a3676b88b60d740
Parents: 5e2fc93
Author: Kanak Biscuitwala <kanak@apache.org>
Authored: Mon Sep 30 11:19:34 2013 -0700
Committer: Kanak Biscuitwala <kanak@apache.org>
Committed: Mon Sep 30 11:19:34 2013 -0700

----------------------------------------------------------------------
 .../helix/api/accessor/ResourceAccessor.java     | 19 +++++++++----------
 .../context/PartitionedRebalancerContext.java    |  2 +-
 2 files changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/416ae8fb/helix-core/src/main/java/org/apache/helix/api/accessor/ResourceAccessor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/api/accessor/ResourceAccessor.java
b/helix-core/src/main/java/org/apache/helix/api/accessor/ResourceAccessor.java
index 7fd901f..0b39d36 100644
--- a/helix-core/src/main/java/org/apache/helix/api/accessor/ResourceAccessor.java
+++ b/helix-core/src/main/java/org/apache/helix/api/accessor/ResourceAccessor.java
@@ -319,20 +319,19 @@ public class ResourceAccessor {
     }
     int bucketSize = 0;
     boolean batchMessageMode = false;
-    RebalancerContext rebalancerContext;
+    RebalancerContext rebalancerContext = null;
     if (idealState != null) {
       rebalancerContext = PartitionedRebalancerContext.from(idealState);
       bucketSize = idealState.getBucketSize();
       batchMessageMode = idealState.getBatchMessageMode();
-    } else {
-      if (resourceConfiguration != null) {
-        bucketSize = resourceConfiguration.getBucketSize();
-        batchMessageMode = resourceConfiguration.getBatchMessageMode();
-        RebalancerConfig rebalancerConfig = new RebalancerConfig(resourceConfiguration);
-        rebalancerContext = rebalancerConfig.getRebalancerContext(RebalancerContext.class);
-      } else {
-        rebalancerContext = new PartitionedRebalancerContext(RebalanceMode.NONE);
-      }
+    } else if (resourceConfiguration != null) {
+      bucketSize = resourceConfiguration.getBucketSize();
+      batchMessageMode = resourceConfiguration.getBatchMessageMode();
+      RebalancerConfig rebalancerConfig = new RebalancerConfig(resourceConfiguration);
+      rebalancerContext = rebalancerConfig.getRebalancerContext(RebalancerContext.class);
+    }
+    if (rebalancerContext == null) {
+      rebalancerContext = new PartitionedRebalancerContext(RebalanceMode.NONE);
     }
     return new Resource(resourceId, type, idealState, resourceAssignment, externalView,
         rebalancerContext, userConfig, bucketSize, batchMessageMode);

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/416ae8fb/helix-core/src/main/java/org/apache/helix/controller/rebalancer/context/PartitionedRebalancerContext.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/controller/rebalancer/context/PartitionedRebalancerContext.java
b/helix-core/src/main/java/org/apache/helix/controller/rebalancer/context/PartitionedRebalancerContext.java
index d428a5e..d202e82 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/rebalancer/context/PartitionedRebalancerContext.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/rebalancer/context/PartitionedRebalancerContext.java
@@ -153,7 +153,7 @@ public class PartitionedRebalancerContext extends BasicRebalancerContext
impleme
   /**
    * Convert a physically-stored IdealState into a rebalancer context for a partitioned resource
    * @param idealState populated IdealState
-   * @return PartitionRebalancerContext
+   * @return PartitionedRebalancerContext
    */
   public static PartitionedRebalancerContext from(IdealState idealState) {
     PartitionedRebalancerContext context;


Mime
View raw message