This is an automated email from the ASF dual-hosted git repository.
markrmiller 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 6452154 SOLR-15648 ManagedSchema#GetZkSchemaVersionCallable can get
into a loop that wants to go on for 10 minutes before it cuts off. (#352)
6452154 is described below
commit 6452154f2493516bb3cdc91a8d30f17e467d4e95
Author: Mark Robert Miller <[email protected]>
AuthorDate: Mon Oct 25 09:01:38 2021 -0500
SOLR-15648 ManagedSchema#GetZkSchemaVersionCallable can get into a loop
that wants to go on for 10 minutes before it cuts off. (#352)
---
.../src/java/org/apache/solr/schema/ManagedIndexSchema.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
index 5ff5e33..c7a7b50 100644
--- a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
+++ b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
@@ -229,7 +229,7 @@ public final class ManagedIndexSchema extends IndexSchema {
// get a list of active replica cores to query for the schema zk version
(skipping this core of course)
List<GetZkSchemaVersionCallable> concurrentTasks = new ArrayList<>();
for (String coreUrl : getActiveReplicaCoreUrls(zkController, collection,
localCoreNodeName))
- concurrentTasks.add(new GetZkSchemaVersionCallable(coreUrl,
schemaZkVersion));
+ concurrentTasks.add(new GetZkSchemaVersionCallable(coreUrl,
schemaZkVersion, zkController));
if (concurrentTasks.isEmpty())
return; // nothing to wait for ...
@@ -318,12 +318,14 @@ public final class ManagedIndexSchema extends IndexSchema
{
private static class GetZkSchemaVersionCallable extends
SolrRequest<SolrResponse> implements Callable<Integer> {
+ private final ZkController zkController;
private String coreUrl;
private int expectedZkVersion;
- GetZkSchemaVersionCallable(String coreUrl, int expectedZkVersion) {
+ GetZkSchemaVersionCallable(String coreUrl, int expectedZkVersion,
+ ZkController zkController) {
super(METHOD.GET, "/schema/zkversion");
-
+ this.zkController = zkController;
this.coreUrl = coreUrl;
this.expectedZkVersion = expectedZkVersion;
}
@@ -340,7 +342,7 @@ public final class ManagedIndexSchema extends IndexSchema {
int remoteVersion = -1;
try (HttpSolrClient solr = new HttpSolrClient.Builder(coreUrl).build()) {
// eventually, this loop will get killed by the ExecutorService's
timeout
- while (remoteVersion == -1 || remoteVersion < expectedZkVersion) {
+ while (remoteVersion == -1 || remoteVersion < expectedZkVersion &&
!zkController.getCoreContainer().isShutDown()) {
try {
HttpSolrClient.HttpUriRequestResponse mrr =
solr.httpUriRequest(this);
NamedList<Object> zkversionResp = mrr.future.get();
@@ -357,6 +359,7 @@ public final class ManagedIndexSchema extends IndexSchema {
} catch (Exception e) {
if (e instanceof InterruptedException) {
+ Thread.currentThread().interrupt();
break; // stop looping
} else {
log.warn("Failed to get /schema/zkversion from {} due to: ",
coreUrl, e);