CNDB-12460: Fix PQVector reencoding when refining in CompactionGraph #1506
+2
−1
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.
What is the issue
When refining PQVectors in CompactionGraph, indexing of vectors may fail because vectors in the graph aren't yet encoded, or vectors may incorrectly be encoded as all zeroes.
What does this PR fix and why was it fixed
When re-encoding vectors after refinement, use the previous count of compressed vectors rather than the max ordinal in the graph. Because adding to the graph is asynchronous, there may be encoded vectors that aren't in the graph. The old approach would not re-encode any vectors with ordinals above the max ordinal. Depending on timing, this could cause vectors to fail to index (if they try to compare to an ordinal that isn't in the encoded vectors) or be encoded as all zeroes (due to the code that fills holes in compressed vectors).
Checklist before you submit for review
NoSpamLogger
for log lines that may appear frequently in the logs