You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LSM_VECTOR: a search whose query vector sits in a deleted region returns an empty neighbor list #5558
Verified on main (no local changes), found while working on #5516.
A vector.neighbors search returns [] - not "the nearest surviving vectors" - when the query vector lands where a group of deleted vectors used to be. The live vectors are still there, still searchable with any other query.
Reproduction
Vertex type with an LSM_VECTOR index (16 dimensions, COSINE, INT8), 100 vertices doc0..doc99 with well-separated embeddings, then delete doc0..doc29:
database.transaction(() -> {
for (inti = 0; i < 30; i++)
database.command("sql", "DELETE FROM Doc WHERE id = ?", "doc" + i);
});
query with the embedding of doc50 (alive, far from the deleted block) -> 5 neighbors, doc50 first. Correct.
query with the embedding of doc3 (deleted, its neighbors doc0..doc6 all deleted) -> []
Reproduces both before and after a reopen, so it is not a persistence problem: the entry count is right (70 live), and every other query works.
Why it looks like a real defect
The graph walk lands in a neighborhood whose nodes are all filtered out as deleted and returns nothing rather than expanding the search to the surviving nodes. So the answer is silently wrong - an empty result reads as "there is nothing similar in this database", when there are 70 live vectors, some of them reasonably close.
The impact scales with the deletion pattern: an application that deletes a topical cluster (a tenant, a document set, a time range) leaves a hole where queries about that topic return nothing at all, which is exactly the query most likely to be asked.
Found while verifying the tombstone-memory fix. It reproduces on pristine main, so it predates that work and is out of its scope. Filing separately so it does not get lost.
The traversal accepted tombstones as answers.Bits.ALL was passed as JVector's accept-filter, and the beam stops once it holds rerankKacceptable candidates - so a query aimed at a deleted neighbourhood filled up with tombstones, declared itself finished, and the post-filter emptied the list. Now filtered by LiveVectorBitsFilter, which works because acceptOrds gates only result admission: JVector still expands a rejected node, so the survivors behind the hole stay reachable and the beam keeps walking until it finds them.
A tombstone was scored through a Float.MIN_NORMAL placeholder. Cosine cancels the magnitude and dimensions * MIN_NORMAL^2 underflows to zero in float, so the similarity came back Infinity - every tombstone was the best candidate in the beam, and on a JVM with assertions enabled the search failed outright on JVector's own 0 <= score <= 1 check.
Your reproduction (100 vertices, delete 30) does not show the empty list on current main, because at that size the graph is rebuilt synchronously on the next search and the brute-force fallback covers what is left. The empty list reproduces exactly as reported on the PQ path - select().vectorNeighbors() on a PRODUCT-quantized index - which is the one search path with neither a delta scan nor a fallback behind it. That is now a regression test.
getStats() also gained a bruteForceScans counter: the fallback scan reads every vector in the index and was previously visible only as a WARNING. If filtered vector queries are slow, look there first.
Activity
review: name the live location map for what it is, and record what th…
review: pin the floor score on every metric, and write down what the …
review: stop PQ encoding a placeholder, count brute-force scans, and …
review: warn off the copy() that would silently undo the sentinel guard
fix(engine) #5558: a vector search inside a deleted region finds the …
lvca commentedon Aug 2, 2026
Fixed in
ca241a087(PR #5739).Both causes were real and independent:
Bits.ALLwas passed as JVector's accept-filter, and the beam stops once it holdsrerankKacceptable candidates - so a query aimed at a deleted neighbourhood filled up with tombstones, declared itself finished, and the post-filter emptied the list. Now filtered byLiveVectorBitsFilter, which works becauseacceptOrdsgates only result admission: JVector still expands a rejected node, so the survivors behind the hole stay reachable and the beam keeps walking until it finds them.Float.MIN_NORMALplaceholder. Cosine cancels the magnitude anddimensions * MIN_NORMAL^2underflows to zero in float, so the similarity came backInfinity- every tombstone was the best candidate in the beam, and on a JVM with assertions enabled the search failed outright on JVector's own0 <= score <= 1check.Your reproduction (100 vertices, delete 30) does not show the empty list on current
main, because at that size the graph is rebuilt synchronously on the next search and the brute-force fallback covers what is left. The empty list reproduces exactly as reported on the PQ path -select().vectorNeighbors()on aPRODUCT-quantized index - which is the one search path with neither a delta scan nor a fallback behind it. That is now a regression test.Three follow-ups came out of the work, all filed:
kcosts a full index scan on every query (26 ms vs 95 us on a 50k index). Pre-existing and measured both ways; the obvious cap is lossy because the graph walk returns 2 of 3 and the fallback is what completes the answer.DOT_PRODUCTindex accepts non-unit vectors, silently breaking that metric's score range.groupByspends its distinct-group budget in traversal order, so a grouped search can return the wrong groups entirely. Independent of deletions.getStats()also gained abruteForceScanscounter: the fallback scan reads every vector in the index and was previously visible only as aWARNING. If filtered vector queries are slow, look there first.fix(engine) #5558: a vector search inside a deleted region finds the …
Reuse the persisted vector graph after a delete instead of rebuilding…