Skip to content

SOLR-18301 overseer election does not converge#4625

Draft
kotman12 wants to merge 5 commits into
apache:mainfrom
kotman12:SOLR-18301-overseer-election-does-not-converge
Draft

SOLR-18301 overseer election does not converge#4625
kotman12 wants to merge 5 commits into
apache:mainfrom
kotman12:SOLR-18301-overseer-election-does-not-converge

Conversation

@kotman12

@kotman12 kotman12 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

Reproducing the stuck-overseer bug caused by close vs start data race. Previously overseer would enter leader election only on session expiry. By triggering election on every reconnect we uncovered certain latent bugs that were relatively rare to hit before but are now a lot more common.

Solution

Returning to previous behavior may be a good place to start, see #4577. I think it is still possible to hit this condition even if you run leader election on session expiry with a really ill-timed reconnect that happens exactly on session boundary. I will try to see what we can do here keeping in mind the uncertainty around the future of overseer.

Tests

  • testOverseerSurvivesZkReconnect

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide
  • I have added a changelog entry for my change

@kotman12 kotman12 marked this pull request as draft July 8, 2026 16:13
linxiaokun528 and others added 2 commits July 8, 2026 13:41
Curator's RECONNECTED event is different from the previous RECONNECTED event. Before Solr10, the OnReconnect is only triggered after a reconnection from a session expiration. Check the following

https://github.com/apache/solr/blob/fdb5314279657f7895a90123436d834e81ea3157/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ConnectionManager.java#L165
https://github.com/apache/solr/blob/fdb5314279657f7895a90123436d834e81ea3157/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ConnectionManager.java#L199

But Curator's RECONNECTED event is triggered every time a Solr node is disconnected from a ZooKeeper instance and reconnected to another ZooKeeper instance.

Therefore, currently ZkController.onReconnect is invoked every time a Solr node reconnects to a ZooKeeper instance without a session expiration, which is a huge overhead, especially when we need to rolling-restart a ZooKeeper Cluster. It can take more than 10 minutes for a small Solr cluster to level out.

Similiarly, now ZkController.onDisconnect is triggered just after a disconnection from a Zookeeper instance. It should only be triggered after a session expiration.
* session possible and to give fine timing granularity around the boundary.
*/
@Test
public void testOverseerWedgesOnExpiryRacingReconnect() throws Exception {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this check to show that this bug pre-dates the curator migration although it would be much harder to hit. Basically you'd need a strong coincidence of a reconnect at the same time as the session expiry. However, if you do a leader re-election on a small network blip that can easily trigger both stop and start in a very tight time window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants