helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kisho...@apache.org
Subject helix git commit: [HELIX-573] Add support to automatically compress/uncompress data in Zookeeper
Date Thu, 12 Mar 2015 04:58:44 GMT
Repository: helix
Updated Branches:
  refs/heads/helix-0.6.x 823a6cac8 -> d704af442


[HELIX-573] Add support to automatically compress/uncompress data in Zookeeper


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

Branch: refs/heads/helix-0.6.x
Commit: d704af4423360b382fc5f895b85ad689fa003b92
Parents: 823a6ca
Author: Kishore Gopalakrishna <g.kishore@gmail.com>
Authored: Wed Mar 11 21:30:31 2015 -0700
Committer: Kishore Gopalakrishna <g.kishore@gmail.com>
Committed: Wed Mar 11 21:30:31 2015 -0700

----------------------------------------------------------------------
 .../stages/ExternalViewComputeStage.java           | 17 +++++++++++------
 .../helix/integration/TestEnableCompression.java   | 11 -----------
 2 files changed, 11 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/d704af44/helix-core/src/main/java/org/apache/helix/controller/stages/ExternalViewComputeStage.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/controller/stages/ExternalViewComputeStage.java
b/helix-core/src/main/java/org/apache/helix/controller/stages/ExternalViewComputeStage.java
index 80529df..d0bdbd9 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/stages/ExternalViewComputeStage.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/stages/ExternalViewComputeStage.java
@@ -121,9 +121,15 @@ public class ExternalViewComputeStage extends AbstractBaseStage {
         clusterStatusMonitor.unregisterResource(view.getResourceName());
       }
 
-      // compare the new external view with current one, set only on different
       ExternalView curExtView = curExtViews.get(resourceName);
+      // copy simplefields from IS, in cases where IS is deleted copy it from existing ExternalView
+      if (idealState != null) {
+        view.getRecord().getSimpleFields().putAll(idealState.getRecord().getSimpleFields());
+      } else if (curExtView != null) {
+        view.getRecord().getSimpleFields().putAll(curExtView.getRecord().getSimpleFields());
+      }
 
+      // compare the new external view with current one, set only on different
       if (curExtView == null || !curExtView.getRecord().equals(view.getRecord())) {
         keys.add(keyBuilder.externalView(resourceName));
         newExtViews.add(view);
@@ -138,9 +144,7 @@ public class ExternalViewComputeStage extends AbstractBaseStage {
                 DefaultSchedulerMessageHandlerFactory.SCHEDULER_TASK_QUEUE)) {
           updateScheduledTaskStatus(view, manager, idealState);
         }
-        if (idealState != null) {
-          view.getRecord().getSimpleFields().putAll(idealState.getRecord().getSimpleFields());
-        }
+
       }
     }
     // TODO: consider not setting the externalview of SCHEDULER_TASK_QUEUE at all.
@@ -235,8 +239,9 @@ public class ExternalViewComputeStage extends AbstractBaseStage {
                       .get(Message.Attributes.MSG_ID.toString()), result);
         }
         // All done for the scheduled tasks that came from controllerMsgId, add summary for
it
-        if (controllerMsgUpdates.get(controllerMsgId).size() == controllerMsgIdCountMap.get(
-            controllerMsgId).intValue()) {
+        Integer controllerMsgIdCount = controllerMsgIdCountMap.get(controllerMsgId);
+        if (controllerMsgIdCount != null
+            && controllerMsgUpdates.get(controllerMsgId).size() == controllerMsgIdCount.intValue())
{
           int finishedTasksNum = 0;
           int completedTasksNum = 0;
           for (String key : controllerStatusUpdate.getRecord().getMapFields().keySet()) {

http://git-wip-us.apache.org/repos/asf/helix/blob/d704af44/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java
b/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java
index 1552e53..45dbd58 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java
@@ -6,24 +6,17 @@ import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 import org.I0Itec.zkclient.serialize.BytesPushThroughSerializer;
-import org.apache.helix.PropertyKey;
 import org.apache.helix.PropertyPathConfig;
 import org.apache.helix.PropertyType;
 import org.apache.helix.TestHelper;
 import org.apache.helix.ZNRecord;
-import org.apache.helix.PropertyKey.Builder;
 import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
-import org.apache.helix.manager.zk.ZKHelixDataAccessor;
-import org.apache.helix.manager.zk.ZkBaseDataAccessor;
 import org.apache.helix.manager.zk.ZkClient;
-import org.apache.helix.model.ExternalView;
 import org.apache.helix.model.IdealState;
 import org.apache.helix.model.builder.CustomModeISBuilder;
-import org.apache.helix.model.builder.IdealStateBuilder;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
-import org.apache.helix.tools.ClusterStateVerifier.MasterNbInExtViewVerifier;
 import org.apache.helix.util.GZipCompressionUtil;
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -99,10 +92,6 @@ public class TestEnableCompression extends ZkIntegrationTestBase {
         new ZkClient(ZK_ADDR, 60 * 1000, 60 * 1000, new BytesPushThroughSerializer());
     zkClient.waitUntilConnected(10, TimeUnit.SECONDS);
 
-    ZKHelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
-    Builder keyBuilder = accessor.keyBuilder();
-
     ClusterControllerManager controller =
         new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
     controller.syncStart();


Mime
View raw message