You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2021/10/21 21:24:01 UTC
[lucene-solr] 02/02: SOLR-15687: UpdateLogCloudTest to avoid shard
leadership transition
This is an automated email from the ASF dual-hosted git repository.
cpoerschke pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit b042569e56c9805369370bc4c6d47c233b6b5ecb
Author: Christine Poerschke <cp...@apache.org>
AuthorDate: Thu Oct 21 21:14:33 2021 +0100
SOLR-15687: UpdateLogCloudTest to avoid shard leadership transition
(cherry picked from commit 9b6de00b923b49bed572c445ba26c30fb5c4c3f3)
---
.../apache/solr/handler/component/UpdateLogCloudTest.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/handler/component/UpdateLogCloudTest.java b/solr/core/src/test/org/apache/solr/handler/component/UpdateLogCloudTest.java
index 1f29532..d733014 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/UpdateLogCloudTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/UpdateLogCloudTest.java
@@ -71,12 +71,18 @@ public class UpdateLogCloudTest extends SolrCloudTestCase {
@Test
public void test() throws Exception {
+ int specialIdx = 0;
+
final List<SolrClient> solrClients = new ArrayList<>();
for (JettySolrRunner jettySolrRunner : cluster.getJettySolrRunners()) {
+ if (!jettySolrRunner.getBaseUrl().toString().equals(
+ getCollectionState(COLLECTION).getLeader("shard1").getBaseUrl())) {
+ specialIdx = solrClients.size();
+ }
solrClients.add(jettySolrRunner.newClient());
}
- cluster.getJettySolrRunner(0).stop();
+ cluster.getJettySolrRunner(specialIdx).stop();
AbstractDistribZkTestBase.waitForRecoveriesToFinish(COLLECTION, cluster.getSolrClient().getZkStateReader(), false, true, DEFAULT_TIMEOUT);
new UpdateRequest()
@@ -85,12 +91,12 @@ public class UpdateLogCloudTest extends SolrCloudTestCase {
.deleteByQuery("a_t:three")
.commit(cluster.getSolrClient(), COLLECTION);
- cluster.getJettySolrRunner(0).start();
+ cluster.getJettySolrRunner(specialIdx).start();
AbstractDistribZkTestBase.waitForRecoveriesToFinish(COLLECTION, cluster.getSolrClient().getZkStateReader(), false, true, DEFAULT_TIMEOUT);
int idx = 0;
for (SolrClient solrClient : solrClients) {
- implTest(solrClient, idx==0 ? 0 : 3);
+ implTest(solrClient, idx==specialIdx ? 0 : 3);
++idx;
}