Conversation
kotman12
marked this pull request as ready for review
October 1, 2026 17:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/SOLR-18480
AI Usage
I used Opus 5/5.5 to iterate on a solution for this. There were probably tens if not hundreds of refinements.
Description
During leader election a new leader will try to tear down its index fetcher. If the old leader process has stalled, this tear-down can take the minimum of graceful executor timeout and socket timeout (in our configuration it stalls for 60s). Since there is no point in gracefully shutting down an index fetch request that gets discarded anyway I propose we abort it without waiting. We have observed this issue in the wild and were lucky enough to reproduce it here.
Solution
Equip the
HttpJettySolrClientwith an eagerabortthat doesn't wait. I only implemented it for the jetty client as it appears to be the only client with robust request tracking support (and the only client currently relevant toIndexFetcher). I create a thin client for each individual fetch so as to isolate what gets aborted. I also added an opt-in for tracking abortable requests. I see no reason tracking of requests this shouldn't at least be an option. Although it would be nice to see if we can simply always track requests (i.e. if the performance penalty for this is small) but I didn't have time to properly benchmark this. Because the consequence is so far-reaching I have left it as an opt-in.An alternative solution could be to tune how long we await for executor termination on abort vs graceful close. However, this is not as elegant and precise regarding timing and would only work for things we are waiting on which are scheduled on that executor.
Tests
Mainly in TlogLeaderElectionFrozenLeaderTest
Checklist
Please review the following and check all that apply:
mainbranch../gradlew check.