lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject lucene-solr:master: SOLR-11452: Leader from collectionState can be null
Date Mon, 30 Oct 2017 03:04:25 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master e0239b9e8 -> cc519b9dd


SOLR-11452: Leader from collectionState can be null


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

Branch: refs/heads/master
Commit: cc519b9dddcc1d2177ab72362637daf1c5b9db8d
Parents: e0239b9
Author: Cao Manh Dat <datcm@apache.org>
Authored: Mon Oct 30 10:04:08 2017 +0700
Committer: Cao Manh Dat <datcm@apache.org>
Committed: Mon Oct 30 10:04:08 2017 +0700

----------------------------------------------------------------------
 .../core/src/test/org/apache/solr/cloud/TestTlogReplica.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cc519b9d/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
index 026bbff..51eac98 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
@@ -676,8 +676,12 @@ public class TestTlogReplica extends SolrCloudTestCase {
     String oldLeaderNodeName = oldLeaderJetty.getNodeName();
     ChaosMonkey.kill(oldLeaderJetty);
     waitForState("Replica not removed", collectionName, activeReplicaCount(0, 1, 0));
-    waitForState("Expect new leader", collectionName, (liveNodes, collectionState) ->
-        !collectionState.getLeader("shard1").getNodeName().equals(oldLeaderNodeName)
+    waitForState("Expect new leader", collectionName,
+        (liveNodes, collectionState) -> {
+          Replica leader = collectionState.getLeader("shard1");
+          if (leader == null) return false;
+          return !leader.getNodeName().equals(oldLeaderNodeName);
+        }
     );
     ChaosMonkey.start(oldLeaderJetty);
     waitForState("Replica not added", collectionName, activeReplicaCount(0, 2, 0));


Mime
View raw message