This is an automated email from the ASF dual-hosted git repository.
mlbiscoc 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 1a8131c4586 SOLR-17745: Reduce leader election optimization never
occurs (#3330)
1a8131c4586 is described below
commit 1a8131c45868ee606348f2502fe57233e3d4489c
Author: Matthew Biscocho <[email protected]>
AuthorDate: Tue May 6 16:24:53 2025 -0400
SOLR-17745: Reduce leader election optimization never occurs (#3330)
Cancel leader election was being skipped on core container shutdown due to
incorrect zkClient check
---------
Co-authored-by: Luke Kot-Zaniewski <[email protected]>
---
solr/CHANGES.txt | 2 ++
solr/core/src/java/org/apache/solr/cloud/ZkController.java | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index a6de31271b9..db2e7aed119 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -277,6 +277,8 @@ Bug Fixes
* SOLR-17638: Some CLI errors not logged when starting prometheus exporter
(Alex Deparvu)
+* SOLR-17745: Cancel leader election was being skipped on core container
shutdown due to incorrect zkClient check (Matthew Biscocho, Luke Kot-Zaniewski)
+
Dependency Upgrades
---------------------
* SOLR-17471: Upgrade Lucene to 9.12.1. (Pierre Salagnac, Christine Poerschke)
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index 1a14c2006a5..ba6798651ce 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -2151,7 +2151,8 @@ public class ZkController implements Closeable {
/** Attempts to cancel all leader elections. This method should be called on
node shutdown. */
public void tryCancelAllElections() {
- if (zkClient.isClosed()) {
+ if (!zkClient.isConnected()) {
+ log.warn("Skipping leader election node cleanup since we're disconnected
from ZooKeeper.");
return;
}
Collection<ElectionContext> values = electionContexts.values();