You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by tf...@apache.org on 2019/02/22 05:40:08 UTC

[lucene-solr] branch branch_8x updated: Fix TestTlogReplica

This is an automated email from the ASF dual-hosted git repository.

tflobbe pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 7e7047a  Fix TestTlogReplica
7e7047a is described below

commit 7e7047a22520631b9900c47b3f67cfd6429dafa3
Author: Tomas Fernandez Lobbe <tf...@apache.org>
AuthorDate: Wed Feb 20 22:23:14 2019 -0800

    Fix TestTlogReplica
    
    At some point got broken and nobody noticed since it's not running
---
 .../org/apache/solr/cloud/TestTlogReplica.java     | 27 ++++++++--------------
 1 file changed, 9 insertions(+), 18 deletions(-)

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 062dac4..d2ed996 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 state
     checkRTG(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");