Skip to content

Apache Lucene open-source search software

SOLR-10397: Break on interruption and always throw KeeperException on read otherwise trigger thread cannot function

Shalin Shekhar Mangarbb408c35a13c
diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/OverseerTriggerThread.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/OverseerTriggerThread.java
index 1a1d3419adc..34a6eaa2df4 100644
--- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/OverseerTriggerThread.java
+++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/OverseerTriggerThread.java
@@ -125,12 +125,13 @@ public class OverseerTriggerThread implements Runnable, Closeable {
// Restore the interrupted status
Thread.currentThread().interrupt();
log.warn("Interrupted", e);
+ break;
} catch (KeeperException e) {
log.error("A ZK error has occurred", e);
}
}
- if (!isClosed || Thread.currentThread().isInterrupted()) return;
+ if (isClosed || Thread.currentThread().isInterrupted()) return;
try {
refreshAutoScalingConf(new AutoScalingWatcher());
@@ -138,11 +139,7 @@ public class OverseerTriggerThread implements Runnable, Closeable {
log.warn("ZooKeeper watch triggered for autoscaling conf, but Solr cannot talk to ZK: [{}]", e.getMessage());
} catch (KeeperException e) {
log.error("A ZK error has occurred", e);
- if (!isClosed) {
- // throw exception only if we haven't been closed already
- throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "A ZK error has occurred", e);
- }
- return; // silently!
+ throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "A ZK error has occurred", e);
} catch (InterruptedException e) {
// Restore the interrupted status
Thread.currentThread().interrupt();