Skip to content

Apache Lucene open-source search software

SOLR-11591: Change the test to not run into the race condition identified until we fix it

Shalin Shekhar Mangar44b7bc017729
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasIntegrationTest.java
index 7b1a0c3a524..600cd658cad 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasIntegrationTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasIntegrationTest.java
@@ -85,7 +85,11 @@ public class AutoAddReplicasIntegrationTest extends SolrCloudTestCase {
List<Replica> replacedHdfsReplicas = getReplacedSharedFsReplicas(COLLECTION1, zkStateReader, lostNodeName);
lostJetty.stop();
waitForNodeLeave(lostNodeName);
- waitForState("Waiting for collection " + COLLECTION1, COLLECTION1, clusterShape(2, 2));
+ // ensure that 2 shards have 2 active replicas and only 4 replicas in total
+ // i.e. old replicas have been deleted.
+ // todo remove the condition for total replicas == 4 after SOLR-11591 is fixed
+ waitForState("Waiting for collection " + COLLECTION1, COLLECTION1, (liveNodes, collectionState) -> clusterShape(2, 2).matches(liveNodes, collectionState)
+ && collectionState.getReplicas().size() == 4);
checkSharedFsReplicasMovedCorrectly(replacedHdfsReplicas, zkStateReader, COLLECTION1);
lostJetty.start();
assertTrue("Timeout waiting for all live and active", ClusterStateUtil.waitForAllActiveAndLiveReplicas(cluster.getSolrClient().getZkStateReader(), 90000));