Apache Solr open-source search software
Fix TestTlogReplica
Tomas Fernandez Lobbe906a08838b59
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.javaindex 062dac4fedb..d2ed9963231 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java@@ -218,7 +218,7 @@ public class TestTlogReplica extends SolrCloudTestCase {CollectionAdminResponse response = CollectionAdminRequest.reloadCollection(collectionName).process(cluster.getSolrClient());assertEquals(0, response.getStatus());- waitForState("failed waiting for active colletion", collectionName, clusterShape(2, 4));+ waitForState("failed waiting for active colletion", collectionName, clusterShape(2, 8));reloaded = true;}}@@ -431,7 +431,7 @@ public class TestTlogReplica extends SolrCloudTestCase {if (removeReplica) {CollectionAdminRequest.addReplicaToShard(collectionName, "shard1", Replica.Type.TLOG).process(cluster.getSolrClient());} else {- leaderJetty.stop();+ leaderJetty.start();}waitForState("Expected collection to be 1x2", collectionName, clusterShape(1, 2));// added replica should replicate from the leader@@ -456,7 +456,7 @@ public class TestTlogReplica extends SolrCloudTestCase {cluster.getSolrClient().commit(collectionName);waitForNumDocsInAllActiveReplicas(2);- pullReplicaJetty.stop();+ pullReplicaJetty.start();waitForState("Replica not added", collectionName, activeReplicaCount(0, 2, 0));waitForNumDocsInAllActiveReplicas(2);}@@ -531,7 +531,6 @@ public class TestTlogReplica extends SolrCloudTestCase {@SuppressWarnings("unchecked")public void testRecovery() throws Exception {- boolean useKill = random().nextBoolean();createAndWaitForCollection(1, 0, 2, 0);CloudSolrClient cloudClient = cluster.getSolrClient();@@ -543,16 +542,12 @@ public class TestTlogReplica extends SolrCloudTestCase {.add(sdoc("id", "5")).process(cloudClient, collectionName);JettySolrRunner solrRunner = getSolrRunner(false).get(0);- if (useKill) {- solrRunner.stop();- } else {- solrRunner.stop();- }+ solrRunner.stop();waitForState("Replica still up", collectionName, activeReplicaCount(0,1,0));new UpdateRequest().add(sdoc("id", "6")).process(cloudClient, collectionName);- solrRunner.stop();+ solrRunner.start();waitForState("Replica didn't recover", collectionName, activeReplicaCount(0,2,0));// We skip peerSync, so replica will always trigger commit on leader// We query only the non-leader replicas, since we haven't opened a new searcher on the leader yet@@ -575,7 +570,7 @@ public class TestTlogReplica extends SolrCloudTestCase {solrRunner.stop();waitForState("Replica still up", collectionName, activeReplicaCount(0,1,0));DirectUpdateHandler2.commitOnClose = true;- solrRunner.stop();+ solrRunner.start();waitForState("Replica didn't recover", collectionName, activeReplicaCount(0,2,0));waitForNumDocsInAllReplicas(5, getNonLeaderReplias(collectionName), 10); //timeout for stale collection statecheckRTG(3,7, cluster.getJettySolrRunners());@@ -593,12 +588,8 @@ public class TestTlogReplica extends SolrCloudTestCase {fail("Test interrupted: " + e.getMessage());}};- if (useKill) {- solrRunner.stop();- } else {- solrRunner.stop();- }solrRunner.stop();+ solrRunner.start();waitingForReplay.acquire();// If I add the doc immediately, the leader fails to communicate with the follower with broken pipe.// Options are, wait or retry...@@ -672,7 +663,7 @@ public class TestTlogReplica extends SolrCloudTestCase {.add(sdoc("id", "3")).add(sdoc("id", "4")).process(cloudClient, collectionName);- oldLeaderJetty.stop();+ oldLeaderJetty.start();waitForState("Replica not added", collectionName, activeReplicaCount(0, 2, 0));checkRTG(1,4, cluster.getJettySolrRunners());new UpdateRequest()@@ -707,7 +698,7 @@ public class TestTlogReplica extends SolrCloudTestCase {return !leader.getNodeName().equals(oldLeaderNodeName);});- oldLeaderJetty.stop();+ oldLeaderJetty.start();waitForState("Replica not added", collectionName, activeReplicaCount(0, 2, 0));checkRTG(1,1, cluster.getJettySolrRunners());SolrDocument doc = cluster.getSolrClient().getById(collectionName,"1");