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 2018/07/12 18:12:03 UTC

[2/3] helix git commit: Fix bugs in ClusterStateVerifier and StrictMatchExternalViewVerifier.

Fix bugs in ClusterStateVerifier and StrictMatchExternalViewVerifier.


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

Branch: refs/heads/master
Commit: 8527a5ae03053d2c1293bad1e60f351681f7ad0b
Parents: b81ef06
Author: Lei Xia <lx...@linkedin.com>
Authored: Wed May 30 10:22:10 2018 -0700
Committer: Lei Xia <lx...@linkedin.com>
Committed: Wed Jul 11 15:23:03 2018 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/helix/tools/ClusterStateVerifier.java | 6 +-----
 .../ClusterVerifiers/StrictMatchExternalViewVerifier.java      | 6 +-----
 2 files changed, 2 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/8527a5ae/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java b/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
index 89a7f28..cc508ef 100644
--- a/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
+++ b/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
@@ -196,11 +196,7 @@ public class ClusterStateVerifier {
         cache.refresh(accessor);
         cache.setTaskCache(false);
 
-        Map<String, IdealState> idealStates = cache.getIdealStates();
-        if (idealStates == null) {
-          // ideal state is null because ideal state is dropped
-          idealStates = Collections.emptyMap();
-        }
+        Map<String, IdealState> idealStates = new HashMap<>(cache.getIdealStates());
 
         // filter out all resources that use Task state model
         Iterator<Map.Entry<String, IdealState>> it = idealStates.entrySet().iterator();

http://git-wip-us.apache.org/repos/asf/helix/blob/8527a5ae/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/StrictMatchExternalViewVerifier.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/StrictMatchExternalViewVerifier.java b/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/StrictMatchExternalViewVerifier.java
index 4c26a18..a1d12fa 100644
--- a/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/StrictMatchExternalViewVerifier.java
+++ b/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/StrictMatchExternalViewVerifier.java
@@ -169,11 +169,7 @@ public class StrictMatchExternalViewVerifier extends ZkHelixClusterVerifier {
       ClusterDataCache cache = new ClusterDataCache();
       cache.refresh(_accessor);
 
-      Map<String, IdealState> idealStates = cache.getIdealStates();
-      if (idealStates == null) {
-        // ideal state is null because ideal state is dropped
-        idealStates = Collections.emptyMap();
-      }
+      Map<String, IdealState> idealStates = new HashMap<>(cache.getIdealStates());
 
       // filter out all resources that use Task state model
       Iterator<Map.Entry<String, IdealState>> it = idealStates.entrySet().iterator();