You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by zz...@apache.org on 2013/09/06 02:07:19 UTC

git commit: [HELIX-109] Review Helix model package, bug fix

Updated Branches:
  refs/heads/helix-logical-model 1d29844a8 -> c07569d47


[HELIX-109] Review Helix model package, bug fix


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

Branch: refs/heads/helix-logical-model
Commit: c07569d471c1f804048c59fd78db72158a992939
Parents: 1d29844
Author: zzhang <zz...@apache.org>
Authored: Thu Sep 5 17:07:06 2013 -0700
Committer: zzhang <zz...@apache.org>
Committed: Thu Sep 5 17:07:06 2013 -0700

----------------------------------------------------------------------
 .../helix/controller/stages/NewExternalViewComputeStage.java   | 5 ++---
 .../java/org/apache/helix/manager/zk/ZKHelixDataAccessor.java  | 6 ------
 .../java/org/apache/helix/manager/zk/ZkBaseDataAccessor.java   | 6 +++++-
 3 files changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/c07569d4/helix-core/src/main/java/org/apache/helix/controller/stages/NewExternalViewComputeStage.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/controller/stages/NewExternalViewComputeStage.java b/helix-core/src/main/java/org/apache/helix/controller/stages/NewExternalViewComputeStage.java
index e98b86e..1a99346 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/stages/NewExternalViewComputeStage.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/stages/NewExternalViewComputeStage.java
@@ -36,6 +36,7 @@ import org.apache.helix.ZNRecord;
 import org.apache.helix.ZNRecordDelta;
 import org.apache.helix.ZNRecordDelta.MergeOperation;
 import org.apache.helix.api.Cluster;
+import org.apache.helix.api.Id;
 import org.apache.helix.api.ParticipantId;
 import org.apache.helix.api.PartitionId;
 import org.apache.helix.api.RebalancerConfig;
@@ -95,7 +96,6 @@ public class NewExternalViewComputeStage extends AbstractBaseStage {
       } else {
         view.setBucketSize(currentStateOutput.getBucketSize(resourceId));
       }
-      System.out.println("cs-output: " + currentStateOutput);
       for (PartitionId partitionId : resource.getPartitionMap().keySet()) {
         Map<ParticipantId, State> currentStateMap =
             currentStateOutput.getCurrentStateMap(resourceId, partitionId);
@@ -151,13 +151,12 @@ public class NewExternalViewComputeStage extends AbstractBaseStage {
 
     // add/update external-views
     if (newExtViews.size() > 0) {
-      System.out.println("write-ev. ev: " + newExtViews.get(0));
       dataAccessor.setChildren(keys, newExtViews);
     }
 
     // remove dead external-views
     for (String resourceName : curExtViews.keySet()) {
-      if (!resourceMap.keySet().contains(resourceName)) {
+      if (!resourceMap.containsKey(Id.resource(resourceName))) {
         dataAccessor.removeProperty(keyBuilder.externalView(resourceName));
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/c07569d4/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixDataAccessor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixDataAccessor.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixDataAccessor.java
index 92adfba..6fbe690 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixDataAccessor.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixDataAccessor.java
@@ -398,8 +398,6 @@ public class ZKHelixDataAccessor implements HelixDataAccessor, ControllerChangeL
     List<List<ZNRecord>> bucketizedRecords =
         new ArrayList<List<ZNRecord>>(Collections.<List<ZNRecord>> nCopies(keys.size(), null));
 
-    // debug
-    boolean dbg = false;
     for (int i = 0; i < keys.size(); i++) {
       PropertyKey key = keys.get(i);
       PropertyType type = key.getType();
@@ -412,7 +410,6 @@ public class ZKHelixDataAccessor implements HelixDataAccessor, ControllerChangeL
       switch (type) {
       case EXTERNALVIEW:
         if (value.getBucketSize() == 0) {
-          dbg = true;
           records.add(value.getRecord());
         } else {
           _baseDataAccessor.remove(path, options);
@@ -442,9 +439,6 @@ public class ZKHelixDataAccessor implements HelixDataAccessor, ControllerChangeL
 
     // set non-bucketized nodes or parent nodes of bucketized nodes
     boolean success[] = _baseDataAccessor.setChildren(paths, records, options);
-    if (dbg) {
-      System.out.println("set. paths: " + paths + ", records: " + records);
-    }
 
 
     // set bucketized nodes

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/c07569d4/helix-core/src/main/java/org/apache/helix/manager/zk/ZkBaseDataAccessor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZkBaseDataAccessor.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZkBaseDataAccessor.java
index 7fb641f..3b0f0fb 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZkBaseDataAccessor.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZkBaseDataAccessor.java
@@ -778,13 +778,17 @@ public class ZkBaseDataAccessor<T> implements BaseDataAccessor<T> {
           String path = paths.get(i);
           T record = (records == null ? null : records.get(i));
           setCbList[i] = new SetDataCallbackHandler();
-          _zkClient.asyncSetData(path, record, -1, setCbList[i]);
 
+          _zkClient.asyncSetData(path, record, -1, setCbList[i]);
         }
 
         boolean failOnNoNode = false;
 
         for (int i = 0; i < size; i++) {
+          if (!needSet[i]) {
+            continue;
+          }
+
           SetDataCallbackHandler cb = setCbList[i];
           cb.waitForSuccess();
           Code rc = Code.get(cb.getRc());