You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2022/11/01 15:44:57 UTC

[solr] branch main updated: Make ReplaceNodeTest faster, use less nodes/shards

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

houston pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 10e96f79770 Make ReplaceNodeTest faster, use less nodes/shards
10e96f79770 is described below

commit 10e96f79770c730349e6798322f43ca7ea3a695b
Author: Houston Putman <ho...@apache.org>
AuthorDate: Tue Nov 1 11:44:42 2022 -0400

    Make ReplaceNodeTest faster, use less nodes/shards
---
 .../src/test/org/apache/solr/cloud/ReplaceNodeTest.java     | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeTest.java b/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeTest.java
index 1af74d73011..42f0f936756 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeTest.java
@@ -216,7 +216,7 @@ public class ReplaceNodeTest extends SolrCloudTestCase {
 
   @Test
   public void testGoodSpreadDuringAssignWithNoTarget() throws Exception {
-    configureCluster(5)
+    configureCluster(4)
         .addConfig(
             "conf1", TEST_PATH().resolve("configsets").resolve("cloud-dynamic").resolve("conf"))
         .configure();
@@ -233,17 +233,19 @@ public class ReplaceNodeTest extends SolrCloudTestCase {
     l = l.subList(2, l.size());
     String nodeToBeDecommissioned = l.get(0);
 
+    int numShards = 3;
+
     // TODO: tlog replicas do not work correctly in tests due to fault
     // TestInjection#waitForInSyncWithLeader
     CollectionAdminRequest.Create create =
-        CollectionAdminRequest.createCollection(coll, "conf1", 4, 3, 0, 0);
+        CollectionAdminRequest.createCollection(coll, "conf1", numShards, 2, 0, 0);
     create.setCreateNodeSet(StrUtils.join(l, ','));
     cloudClient.request(create);
 
     cluster.waitForActiveCollection(
         coll,
-        4,
-        4
+        numShards,
+        numShards
             * (create.getNumNrtReplicas()
                 + create.getNumPullReplicas()
                 + create.getNumTlogReplicas()));
@@ -258,7 +260,8 @@ public class ReplaceNodeTest extends SolrCloudTestCase {
     createReplaceNodeRequest(nodeToBeDecommissioned, null, true)
         .processAndWait("000", cloudClient, 15);
 
-    DocCollection collection = cloudClient.getClusterState().getCollection(coll);
+    DocCollection collection = cloudClient.getClusterState().getCollectionOrNull(coll, false);
+    assertNotNull("Collection cannot be null: " + coll, collection);
     log.debug("### After decommission: {}", collection);
     // check what are replica states on the decommissioned node
     List<Replica> replicas = collection.getReplicas(nodeToBeDecommissioned);