You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2017/12/20 17:54:41 UTC

[38/50] [abbrv] helix git commit: Fix a bug in ClusterDataCache.

Fix a bug in ClusterDataCache.


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

Branch: refs/heads/master
Commit: ecc939cc6ccbfd4ca32e9aaba7b5251bf6d3d1f2
Parents: ecdbaa1
Author: Lei Xia <lx...@linkedin.com>
Authored: Wed Sep 27 17:21:41 2017 -0700
Committer: Junkai Xue <jx...@linkedin.com>
Committed: Mon Nov 6 17:08:40 2017 -0800

----------------------------------------------------------------------
 .../apache/helix/controller/stages/ClusterDataCache.java  |  8 ++++----
 .../apache/helix/integration/TestBucketizedResource.java  |  2 +-
 .../java/org/apache/helix/integration/TestDriver.java     | 10 ++++++----
 3 files changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/ecc939cc/helix-core/src/main/java/org/apache/helix/controller/stages/ClusterDataCache.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/controller/stages/ClusterDataCache.java b/helix-core/src/main/java/org/apache/helix/controller/stages/ClusterDataCache.java
index cf8732e..5048325 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/stages/ClusterDataCache.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/stages/ClusterDataCache.java
@@ -136,8 +136,8 @@ public class ClusterDataCache {
 
     if (_propertyDataChangedMap.get(ChangeType.IDEAL_STATE)) {
       long start = System.currentTimeMillis();
-      _idealStateCacheMap = accessor.getChildValuesMap(keyBuilder.idealStates());
       _propertyDataChangedMap.put(ChangeType.IDEAL_STATE, Boolean.valueOf(false));
+      _idealStateCacheMap = accessor.getChildValuesMap(keyBuilder.idealStates());
       if (LOG.isDebugEnabled()) {
         LOG.debug("Reload IdealStates: " + _idealStateCacheMap.keySet() + ". Takes " + (
             System.currentTimeMillis() - start) + " ms");
@@ -145,21 +145,21 @@ public class ClusterDataCache {
     }
 
     if (_propertyDataChangedMap.get(ChangeType.LIVE_INSTANCE)) {
-      _liveInstanceCacheMap = accessor.getChildValuesMap(keyBuilder.liveInstances());
       _propertyDataChangedMap.put(ChangeType.LIVE_INSTANCE, Boolean.valueOf(false));
+      _liveInstanceCacheMap = accessor.getChildValuesMap(keyBuilder.liveInstances());
       _updateInstanceOfflineTime = true;
       LOG.debug("Reload LiveInstances: " + _liveInstanceCacheMap.keySet());
     }
 
     if (_propertyDataChangedMap.get(ChangeType.INSTANCE_CONFIG)) {
-      _instanceConfigCacheMap = accessor.getChildValuesMap(keyBuilder.instanceConfigs());
       _propertyDataChangedMap.put(ChangeType.INSTANCE_CONFIG, Boolean.valueOf(false));
+      _instanceConfigCacheMap = accessor.getChildValuesMap(keyBuilder.instanceConfigs());
       LOG.debug("Reload InstanceConfig: " + _instanceConfigCacheMap.keySet());
     }
 
     if (_propertyDataChangedMap.get(ChangeType.RESOURCE_CONFIG)) {
-      _resourceConfigCacheMap = accessor.getChildValuesMap(accessor.keyBuilder().resourceConfigs());
       _propertyDataChangedMap.put(ChangeType.RESOURCE_CONFIG, Boolean.valueOf(false));
+      _resourceConfigCacheMap = accessor.getChildValuesMap(accessor.keyBuilder().resourceConfigs());
       LOG.debug("Reload ResourceConfigs: " + _resourceConfigCacheMap.size());
     }
 

http://git-wip-us.apache.org/repos/asf/helix/blob/ecc939cc/helix-core/src/test/java/org/apache/helix/integration/TestBucketizedResource.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestBucketizedResource.java b/helix-core/src/test/java/org/apache/helix/integration/TestBucketizedResource.java
index 5e678d0..1b764d4 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestBucketizedResource.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestBucketizedResource.java
@@ -166,7 +166,7 @@ public class TestBucketizedResource extends ZkIntegrationTestBase {
     participants[0].syncStop();
     participants[0] = new MockParticipantManager(ZK_ADDR, clusterName, instanceNames.get(0));
     participants[0].syncStart();
-
+    
     Assert.assertTrue(_clusterVerifier.verify());
 
     // make sure participants[0]'s current state is bucketzied correctly during carryover

http://git-wip-us.apache.org/repos/asf/helix/blob/ecc939cc/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java b/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java
index 6eae837..37e6ffb 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java
@@ -40,6 +40,8 @@ import org.apache.helix.store.PropertyJsonSerializer;
 import org.apache.helix.store.PropertyStoreException;
 import org.apache.helix.tools.ClusterSetup;
 import org.apache.helix.tools.ClusterStateVerifier;
+import org.apache.helix.tools.ClusterVerifiers.BestPossibleExternalViewVerifier;
+import org.apache.helix.tools.ClusterVerifiers.HelixClusterVerifier;
 import org.apache.helix.tools.DefaultIdealStateCalculator;
 import org.apache.helix.tools.TestCommand;
 import org.apache.helix.tools.TestExecutor;
@@ -237,10 +239,10 @@ public class TestDriver {
     TestInfo testInfo = _testInfoMap.get(uniqClusterName);
     String clusterName = testInfo._clusterName;
 
-    boolean result =
-        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
-            ZK_ADDR, clusterName), timeout);
-    Assert.assertTrue(result);
+    HelixClusterVerifier verifier =
+        new BestPossibleExternalViewVerifier.Builder(clusterName).setZkAddr(ZK_ADDR).build();
+    Assert.assertTrue(verifier.verify());
+
   }
 
   public static void stopCluster(String uniqClusterName) throws Exception {