test(mem_wal): cover vector/FTS search correctness under row updates#6844
Open
hamersaw wants to merge 1 commit into
Open
test(mem_wal): cover vector/FTS search correctness under row updates#6844hamersaw wants to merge 1 commit into
hamersaw wants to merge 1 commit into
Conversation
Adds tests validating newest-wins behavior for vector and FTS search when a primary key is re-inserted (an update). - test_vector_search_cross_generation_override_excludes_stale (passing): proves the implemented algorithm — a row written to the base table and then re-inserted with a different vector in a newer generation has its stale (closer) vector dropped by FilterStaleExec via the generation PK bloom filter, even when it would otherwise rank first by distance. - test_vector_search_same_l0_override_newest_wins (failing spec): same primary key inserted twice within one active memtable (same generation). FilterStaleExec only consults bloom filters of strictly newer generations and the active arm carries no _rowaddr tiebreak, so both versions are returned with no newest-wins resolution — unlike the full-scan path's DeduplicateExec. - test_fts_same_l0_override_newest_wins (failing spec): FTS has no LSM staleness path and the mem index is append-only with no PK tombstone/dedup, so an overridden document is still matched. The two failing tests are an executable spec for the intra-generation override gap; only test additions, no production code changes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
What
Tests validating that
mem_walvector and FTS search return newest-wins results when a primary key is updated (re-inserted with new content).Findings
Row-override resolution in the search paths is only implemented across LSM generations, and only for vector search:
LsmVectorSearchPlanner+FilterStaleExecdrop a candidate from generation G when its PK appears in a strictly newer generation's PK bloom filter.FilterStaleExecbreaks as soon asbf.generation <= row_generation, and the active vector arm carries no_rowaddrinsert-order tiebreak — unlike the full-scan path, whereDeduplicateExecsorts(pk ASC, _memtable_gen DESC, _rowaddr DESC)and keeps the newest.Tests added (test-only; no production changes)
test_vector_search_cross_generation_override_excludes_staletest_vector_search_same_l0_override_newest_wins[(1, 0.0), (2, 0.04), (1, 384.16)]— id=1 returned twice, no newest-wins resolution.test_fts_same_l0_override_newest_winsid=1doc"apple"then re-inserted as"banana"in a later batch; searching"apple"still returns the stale document.The two failing tests are an executable spec for the intra-generation override gap, kept failing (not
#[ignore]d) so the gap is visible in CI. They encode the intended contract for whoever implements same-L0 newest-wins resolution in the vector/FTS search path.Note
This PR is intentionally red on the two spec tests. Merging requires either implementing the same-L0 resolution or deciding how to track the gap.
🤖 Generated with Claude Code