You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by br...@apache.org on 2023/01/24 14:55:21 UTC
[solr] branch branch_9x updated: SOLR-16438: Increase the socket timeout for split test on three hosts.
This is an automated email from the ASF dual-hosted git repository.
broustant pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new e85eb404674 SOLR-16438: Increase the socket timeout for split test on three hosts.
e85eb404674 is described below
commit e85eb4046742d81cac1b6756f95eab4325e31ba8
Author: Bruno Roustant <br...@gmail.com>
AuthorDate: Tue Jan 24 11:31:49 2023 +0100
SOLR-16438: Increase the socket timeout for split test on three hosts.
---
.../test/org/apache/solr/cloud/SplitShardTest.java | 20 +++++++++++--
.../apache/solr/cloud/MiniSolrCloudCluster.java | 33 +++++++++++++++++-----
2 files changed, 44 insertions(+), 9 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/cloud/SplitShardTest.java b/solr/core/src/test/org/apache/solr/cloud/SplitShardTest.java
index ddcd5c57d55..b0f036ec637 100644
--- a/solr/core/src/test/org/apache/solr/cloud/SplitShardTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/SplitShardTest.java
@@ -203,7 +203,20 @@ public class SplitShardTest extends SolrCloudTestCase {
}
private void setupCluster(int nodeCount) throws Exception {
- configureCluster(nodeCount).addConfig("conf", configset("cloud-minimal")).configure();
+ setupCluster(nodeCount, null, null);
+ }
+
+ private void setupCluster(int nodeCount, Integer connectionTimeout, Integer socketTimeout)
+ throws Exception {
+ MiniSolrCloudCluster.Builder builder =
+ configureCluster(nodeCount).addConfig("conf", configset("cloud-minimal"));
+ if (connectionTimeout != null) {
+ builder.withConnectionTimeout(connectionTimeout);
+ }
+ if (socketTimeout != null) {
+ builder.withSocketTimeout(socketTimeout);
+ }
+ builder.configure();
}
private CloudSolrClient createCollection(String collectionName, int repFactor) throws Exception {
@@ -270,7 +283,10 @@ public class SplitShardTest extends SolrCloudTestCase {
@Test
public void testConcurrentSplitThreeHostsRepFactorTwo() throws Exception {
- setupCluster(3);
+ // Increase the default mini-cluster timeouts (see MiniSolrCloudCluster.buildSolrClient)
+ // because this split test on three hosts takes quite some time during the split
+ // on some test envs.
+ setupCluster(3, 30000, 120000);
splitWithConcurrentUpdates("livesplit-3-2", 2, 4, true);
}
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
index 36a34cef0f5..94e71687229 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
@@ -282,7 +282,9 @@ public class MiniSolrCloudCluster {
zkTestServer,
securityJson,
false,
- formatZkServer);
+ formatZkServer,
+ Optional.empty(),
+ Optional.empty());
}
/**
* Create a MiniSolrCloudCluster. Note - this constructor visibility is changed to package
@@ -306,7 +308,9 @@ public class MiniSolrCloudCluster {
ZkTestServer zkTestServer,
Optional<String> securityJson,
boolean trackJettyMetrics,
- boolean formatZkServer)
+ boolean formatZkServer,
+ Optional<Integer> connectionTimeout,
+ Optional<Integer> socketTimeout)
throws Exception {
Objects.requireNonNull(securityJson);
@@ -369,7 +373,7 @@ public class MiniSolrCloudCluster {
throw startupError;
}
- solrClient = buildSolrClient();
+ solrClient = buildSolrClient(connectionTimeout, socketTimeout);
if (numServers > 0) {
waitForAllNodes(numServers, 60);
@@ -746,11 +750,12 @@ public class MiniSolrCloudCluster {
}
}
- protected CloudSolrClient buildSolrClient() {
+ protected CloudSolrClient buildSolrClient(
+ Optional<Integer> connectionTimeout, Optional<Integer> socketTimeout) {
return new CloudLegacySolrClient.Builder(
Collections.singletonList(getZkServer().getZkAddress()), Optional.empty())
- .withSocketTimeout(90000)
- .withConnectionTimeout(15000)
+ .withSocketTimeout(socketTimeout.orElse(90000))
+ .withConnectionTimeout(connectionTimeout.orElse(15000))
.build(); // we choose 90 because we run in some harsh envs
}
@@ -1036,6 +1041,8 @@ public class MiniSolrCloudCluster {
private boolean useDistributedCollectionConfigSetExecution;
private boolean useDistributedClusterStateUpdate;
private boolean formatZkServer = true;
+ private Optional<Integer> connectionTimeout = Optional.empty();
+ private Optional<Integer> socketTimeout = Optional.empty();
/**
* Create a builder
@@ -1196,6 +1203,16 @@ public class MiniSolrCloudCluster {
return this;
}
+ public Builder withConnectionTimeout(Integer connectionTimeout) {
+ this.connectionTimeout = Optional.of(connectionTimeout);
+ return this;
+ }
+
+ public Builder withSocketTimeout(Integer socketTimeout) {
+ this.socketTimeout = Optional.of(socketTimeout);
+ return this;
+ }
+
/**
* Configure and run the {@link MiniSolrCloudCluster}
*
@@ -1239,7 +1256,9 @@ public class MiniSolrCloudCluster {
null,
securityJson,
trackJettyMetrics,
- formatZkServer);
+ formatZkServer,
+ connectionTimeout,
+ socketTimeout);
for (Config config : configs) {
cluster.uploadConfigSet(config.path, config.name);
}