lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r1659850 - in /lucene/dev/trunk/solr: CHANGES.txt core/src/test/org/apache/solr/cloud/DeleteInactiveReplicaTest.java core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java
Date Sat, 14 Feb 2015 19:44:51 GMT
Author: shalin
Date: Sat Feb 14 19:44:51 2015
New Revision: 1659850

URL: http://svn.apache.org/r1659850
Log:
SOLR-7112: Fix DeleteInactiveReplicaTest.deleteLiveReplicaTest test failures

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteInactiveReplicaTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1659850&r1=1659849&r2=1659850&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Sat Feb 14 19:44:51 2015
@@ -164,6 +164,9 @@ Other Changes
   when no qt or shard.qt parameter is specified; fix also resolves SOLR-4479.
   (Steve Molloy, Timothy Potter)
 
+* SOLR-7112: Fix DeleteInactiveReplicaTest.deleteLiveReplicaTest test failures.
+  (shalin)
+
 ==================  5.0.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteInactiveReplicaTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteInactiveReplicaTest.java?rev=1659850&r1=1659849&r2=1659850&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteInactiveReplicaTest.java
(original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteInactiveReplicaTest.java
Sat Feb 14 19:44:51 2015
@@ -32,13 +32,16 @@ import org.apache.solr.common.util.Named
 import org.junit.Test;
 
 import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import static org.apache.solr.cloud.CollectionsAPIDistributedZkTest.setClusterProp;
+import static org.apache.solr.cloud.OverseerCollectionProcessor.NUM_SLICES;
 import static org.apache.solr.common.cloud.ZkNodeProps.makeMap;
+import static org.apache.solr.common.cloud.ZkStateReader.MAX_SHARDS_PER_NODE;
 
-//@Ignore("Not currently valid see SOLR-5580")
-public class DeleteInactiveReplicaTest extends DeleteReplicaTest{
+public class DeleteInactiveReplicaTest extends AbstractFullDistribZkTestBase{
 
   @Test
   public void deleteInactiveReplicaTest() throws Exception {
@@ -48,7 +51,13 @@ public class DeleteInactiveReplicaTest e
 
       setClusterProp(client, ZkStateReader.LEGACY_CLOUD, "false");
 
-      createCollection(collectionName, client);
+      int replicationFactor = 2;
+      int numShards = 2;
+      int maxShardsPerNode = ((((numShards+1) * replicationFactor) / getCommonCloudSolrClient()
+          .getZkStateReader().getClusterState().getLiveNodes().size())) + 1;
+
+      Map<String,List<Integer>> collectionInfos = new HashMap<>();
+      createCollection(collectionInfos, collectionName, numShards, replicationFactor, maxShardsPerNode,
client, null);
 
       waitForRecoveriesToFinish(collectionName, false);
 
@@ -109,7 +118,7 @@ public class DeleteInactiveReplicaTest e
       }
 
       log.info("removed_replicas {}/{} ", shard1.getName(), replica1.getName());
-      removeAndWaitForReplicaGone(collectionName, client, replica1,
+      DeleteReplicaTest.removeAndWaitForReplicaGone(collectionName, client, replica1,
           shard1.getName());
       ChaosMonkey.start(stoppedJetty);
       log.info("restarted jetty");

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java?rev=1659850&r1=1659849&r2=1659850&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java Sat Feb
14 19:44:51 2015
@@ -50,11 +50,6 @@ import static org.apache.solr.common.par
 public class DeleteReplicaTest extends AbstractFullDistribZkTestBase {
   private CloudSolrClient client;
   
-  @BeforeClass
-  public static void beforeThisClass2() throws Exception {
-
-  }
-
   @Override
   public void distribSetUp() throws Exception {
     super.distribSetUp();
@@ -146,7 +141,7 @@ public class DeleteReplicaTest extends A
     client.request(request);
   }
 
-  protected void removeAndWaitForReplicaGone(String COLL_NAME,
+  static void removeAndWaitForReplicaGone(String COLL_NAME,
       CloudSolrClient client, Replica replica, String shard)
       throws SolrServerException, IOException, InterruptedException {
     Map m = makeMap("collection", COLL_NAME, "action", DELETEREPLICA.toLower(), "shard",
@@ -159,7 +154,7 @@ public class DeleteReplicaTest extends A
     boolean success = false;
     DocCollection testcoll = null;
     while (System.currentTimeMillis() < endAt) {
-      testcoll = getCommonCloudSolrClient().getZkStateReader()
+      testcoll = client.getZkStateReader()
           .getClusterState().getCollection(COLL_NAME);
       success = testcoll.getSlice(shard).getReplica(replica.getName()) == null;
       if (success) {



Mime
View raw message