Repository navigation
SOLR-5754: StreamingSolrClients.getErrors() returns a snapshot copy instead of the live list - #5073
Open
nick-boss-tech wants to merge 7 commits into
Open
nick-boss-tech wants to merge 7 commits into
nick-boss-tech wants to merge 7 commits into
Conversation
…atomically Hypothetical, unrun regression test; see SOLR-5754-TESTING.md.
…log and testing note
nick-boss-tech
marked this pull request as ready for review
October 9, 2026 23:25
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.
🤖 AI text below 🤖 (posted on behalf of Nick Shanin)
https://issues.apache.org/jira/browse/SOLR-5754
What happens today
The retry pass reads the errors, then clears the list in a second call. An error added in between can be cleared without a retry.
Before this change, the retry pass copied the live error list and cleared it later in the same method. An error added between those two steps was cleared unseen. On the paths read, that window does not open, so this change is hardening, not a fix for a reproduced bug.
What this change does
Errors are read as a snapshot, and the retry pass takes them with one atomic drain.
getErrors()returns a copy taken under the list's lock (StreamingSolrClients.java). This is a public behavior change. A caller now gets a snapshot, not the live list.drainErrors()copies and clears the list in one step under the same lock (StreamingSolrClients.java).drainErrors()(SolrCmdDistributor.java). The laterclearErrors()call is removed.errorsfield is package-private and final, so the tests can seed it (StreamingSolrClients.java).Proof
The combined run passed on a merged tree. There is no separate run without the fix for this branch; it was tested on the combined tree.
7fbe0128d8b0: 26 of 26 tests pass, on a local merge commit of SOLR-5939 and this change,1ddbf36202d, whose tree isf2e33340f0ea.TestTolerantUpdateProcessorCloud19/19 andTestTolerantUpdateProcessorRandomCloud2/2. The module checks pass.4bdf281d3cb3removes only the rootSOLR-5754-TESTING.mdfile, a note that is not part of the change; that removal was checked directly.testGetErrorsIsASnapshotandtestDrainErrorsReturnsAndClears. It passed 2 of 2 in the same combined run. It skips itself when Mockito cannot mock (L29-L32).Limits
This is hardening. The race is not reproduced, and the tests are single-threaded.
clearErrors()stays public and has no caller in main code. This change does not remove it.Changelog:
changelog/unreleased/SOLR-5754-streaming-clients-error-snapshot.yml(type: changed).AI assistance
AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution.