Skip to content

Fix flaky tests in TestColumnBatchIndexing#16075

Merged
romseygeek merged 1 commit into
apache:mainfrom
Tim-Brooks:fix_column_tests
May 18, 2026
Merged

Fix flaky tests in TestColumnBatchIndexing#16075
romseygeek merged 1 commit into
apache:mainfrom
Tim-Brooks:fix_column_tests

Conversation

@Tim-Brooks
Copy link
Copy Markdown
Contributor

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.

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.
@Tim-Brooks
Copy link
Copy Markdown
Contributor Author

I cannot add the label, but I think this does not require a change log.

@romseygeek romseygeek added the skip-changelog Apply to PRs that don't need a changelog entry, stopping the automated changelog check. label May 18, 2026
Copy link
Copy Markdown
Contributor

@ChrisHegarty ChrisHegarty left a comment

Choose a reason for hiding this comment

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

LGTM

@dweiss
Copy link
Copy Markdown
Contributor

dweiss commented May 18, 2026

Thank you for a quick follow up!

@romseygeek romseygeek merged commit 64c7fcc into apache:main May 18, 2026
12 of 13 checks passed
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.
@romseygeek
Copy link
Copy Markdown
Contributor

Merged and backported, thanks for fixing @Tim-Brooks!

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

Labels

module:core/index skip-changelog Apply to PRs that don't need a changelog entry, stopping the automated changelog check.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants