helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject [32/53] [abbrv] git commit: [HELIX-248] More IdealState/RebalancerContext compatibility
Date Thu, 07 Nov 2013 01:19:40 GMT
[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/8c17dace
Tree: http://git-wip-us.apache.org/repos/asf/incubator-helix/tree/8c17dace
Diff: http://git-wip-us.apache.org/repos/asf/incubator-helix/diff/8c17dace

Branch: refs/heads/master
Commit: 8c17dace70ecf3d88fd500f5aa02d2dfc7febaf7
Parents: b32849f
Author: Kanak Biscuitwala <kanak@apache.org>
Authored: Mon Sep 30 11:19:34 2013 -0700
Committer: Kanak Biscuitwala <kanak@apache.org>
Committed: Wed Nov 6 13:17:35 2013 -0800

----------------------------------------------------------------------
 .../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/8c17dace/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/8c17dace/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