Skip to content

Match merged vectors by document id, not by ordinal position - #2556

Open
imotov wants to merge 1 commit into
NVIDIA:mainfrom
imotov:issue-2550-merge-bug
Open

Match merged vectors by document id, not by ordinal position#2556
imotov wants to merge 1 commit into
NVIDIA:mainfrom
imotov:issue-2550-merge-bug

Conversation

@imotov

@imotov imotov commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

testMergeTwoSegsWithASingleDocPerSeg and testTwoVectorFieldsPerDoc asserted that ordinal i of the merged segment holds the i-th document's vector. Lucene does not offer that: MockRandomMergePolicy shuffles the segments of a forced merge on purpose, so the document committed second can land at ordinal 0. Stock Lucene99HnswVectorsFormat fails the same tests on the same seeds, so no cuVS writer is involved.

The assertions now resolve each ordinal to its document and check that the document kept its own vector, which leaves the randomized merge policy in play. ordToDoc is checked to be increasing so the id lookup cannot agree with a mapping that is itself garbled. Applied to the quantized and GPU-search formats too, which carried the same assumption unreported.

Closes #2550

testMergeTwoSegsWithASingleDocPerSeg and testTwoVectorFieldsPerDoc asserted
that ordinal i of the merged segment holds the i-th document's vector. Lucene
does not offer that: MockRandomMergePolicy shuffles the segments of a forced
merge on purpose, so the document committed second can land at ordinal 0.
Stock Lucene99HnswVectorsFormat fails the same tests on the same seeds, so no
cuVS writer is involved.

The assertions now resolve each ordinal to its document and check that the
document kept its own vector, which leaves the randomized merge policy in
play. ordToDoc is checked to be increasing so the id lookup cannot agree with
a mapping that is itself garbled. Applied to the quantized and GPU-search
formats too, which carried the same assumption unreported.

Closes NVIDIA#2550
@imotov imotov self-assigned this Sep 4, 2026
@imotov
imotov requested a review from a team as a code owner September 4, 2026 19:52
@imotov imotov added non-breaking Introduces a non-breaking change testing Lucene bug Something isn't working labels Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Lucene non-breaking Introduces a non-breaking change testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] TestLucene99AcceleratedHNSWVectorsFormat.testMergeTwoSegsWithASingleDocPerSeg fails with vector data mismatch after forceMerge(1)

1 participant