Fix flaky tests in TestColumnBatchIndexing#16075
Merged
Merged
Conversation
newIndexWriterConfig() randomizes maxBufferedDocs. When multiple writes (addBatch or addDocument) exceed the flush threshold, an auto-flush occurs mid-sequence producing more than one segment. getOnlyLeafReader then fails with "Expected only one leaf reader". Fix all eight affected tests by calling forceMerge(1) before opening the reader. Tests that assert specific doc-ID order also pin TieredMergePolicy: MockRandomMergePolicy can reverse segment order during a merge, so without it forceMerge(1) does not guarantee that the merged doc-IDs match insertion order.
Contributor
Author
|
I cannot add the label, but I think this does not require a change log. |
Contributor
|
Thank you for a quick follow up! |
romseygeek
pushed a commit
that referenced
this pull request
May 18, 2026
newIndexWriterConfig() randomizes maxBufferedDocs. When multiple writes (addBatch or addDocument) exceed the flush threshold, an auto-flush occurs mid-sequence producing more than one segment. getOnlyLeafReader then fails with "Expected only one leaf reader". Fix all eight affected tests by calling forceMerge(1) before opening the reader. Tests that assert specific doc-ID order also pin TieredMergePolicy: MockRandomMergePolicy can reverse segment order during a merge, so without it forceMerge(1) does not guarantee that the merged doc-IDs match insertion order.
Contributor
|
Merged and backported, thanks for fixing @Tim-Brooks! |
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.
newIndexWriterConfig() randomizes maxBufferedDocs. When multiple writes
(addBatch or addDocument) exceed the flush threshold, an auto-flush
occurs mid-sequence producing more than one segment. getOnlyLeafReader
then fails with "Expected only one leaf reader".
Fix all eight affected tests by calling forceMerge(1) before opening
the reader. Tests that assert specific doc-ID order also pin
TieredMergePolicy: MockRandomMergePolicy can reverse segment order
during a merge, so without it forceMerge(1) does not guarantee that
the merged doc-IDs match insertion order.