This is an automated email from the ASF dual-hosted git repository.
cpoerschke 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 bab9d28 SOLR-15486: make
SolrCoreState.pauseUpdatesAndAwaitInflightRequests logic not SolrCloud specific
(#180)
bab9d28 is described below
commit bab9d2878c36630fd62b271da5f224fa00e396c0
Author: Christine Poerschke <[email protected]>
AuthorDate: Tue Aug 3 18:23:31 2021 +0100
SOLR-15486: make SolrCoreState.pauseUpdatesAndAwaitInflightRequests logic
not SolrCloud specific (#180)
---
solr/CHANGES.txt | 3 ++
.../java/org/apache/solr/core/CoreContainer.java | 46 ++++++++++++----------
2 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index d13ceed..b2b26a2 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -411,6 +411,9 @@ Other Changes
* SOLR-15573: bin/solr auth utility should provide role bindings for
`security-read` and `config-edit` by default
to protect the security and schema designer screens in the Admin UI (Timothy
Potter)
+* SOLR-15486: During node shutdown pausing of updates and waiting for
in-flight update requests to finish
+ before closing cores is no longer SolrCloud specific. (Christine Poerschke,
David Smiley)
+
================== 8.9.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this
release.
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 9626799..bf80294 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -1033,26 +1033,9 @@ public class CoreContainer {
if (isZooKeeperAware()) {
cancelCoreRecoveries();
zkSys.zkController.preClose();
- /*
- * Pause updates for all cores on this node and wait for all in-flight
update requests to finish.
- * Here, we (slightly) delay leader election so that in-flight update
requests succeed and we can preserve consistency.
- *
- * Jetty already allows a grace period for in-flight requests to
complete and our solr cores, searchers etc
- * are reference counted to allow for graceful shutdown. So we don't
worry about any other kind of requests.
- *
- * We do not need to unpause ever because the node is being shut down.
- */
- getCores().parallelStream().forEach(solrCore -> {
- SolrCoreState solrCoreState = solrCore.getSolrCoreState();
- try {
- solrCoreState.pauseUpdatesAndAwaitInflightRequests();
- } catch (TimeoutException e) {
- log.warn("Timed out waiting for in-flight update requests to
complete for core: {}", solrCore.getName());
- } catch (InterruptedException e) {
- log.warn("Interrupted while waiting for in-flight update requests
to complete for core: {}", solrCore.getName());
- Thread.currentThread().interrupt();
- }
- });
+ }
+ pauseUpdatesAndAwaitInflightRequests();
+ if (isZooKeeperAware()) {
zkSys.zkController.tryCancelAllElections();
}
@@ -1206,6 +1189,29 @@ public class CoreContainer {
}
}
+ /**
+ * Pause updates for all cores on this node and wait for all in-flight
update requests to finish.
+ * Here, we (slightly) delay leader election so that in-flight update
requests succeed and we can preserve consistency.
+ *
+ * Jetty already allows a grace period for in-flight requests to complete
and our solr cores, searchers etc
+ * are reference counted to allow for graceful shutdown. So we don't worry
about any other kind of requests.
+ *
+ * We do not need to unpause ever because the node is being shut down.
+ */
+ private void pauseUpdatesAndAwaitInflightRequests() {
+ getCores().parallelStream().forEach(solrCore -> {
+ SolrCoreState solrCoreState = solrCore.getSolrCoreState();
+ try {
+ solrCoreState.pauseUpdatesAndAwaitInflightRequests();
+ } catch (TimeoutException e) {
+ log.warn("Timed out waiting for in-flight update requests to complete
for core: {}", solrCore.getName());
+ } catch (InterruptedException e) {
+ log.warn("Interrupted while waiting for in-flight update requests to
complete for core: {}", solrCore.getName());
+ Thread.currentThread().interrupt();
+ }
+ });
+ }
+
public CoresLocator getCoresLocator() {
return coresLocator;
}