Skip to content

Fix VREM of disk-evicted Vector Set element spuriously reporting not-found#1961

Draft
tiagonapoli wants to merge 3 commits into
mainfrom
tiagonapoli/fix-diskann-delete-callback
Draft

Fix VREM of disk-evicted Vector Set element spuriously reporting not-found#1961
tiagonapoli wants to merge 3 commits into
mainfrom
tiagonapoli/fix-diskann-delete-callback

Conversation

@tiagonapoli

Copy link
Copy Markdown
Collaborator

Problem

VREM of a Vector Set element silently reported "not removed" (:0, no error) whenever that element's records had been evicted to disk.

The DiskANN delete callback (VectorManager.DeleteCallbackUnmanaged) gated its return value on status.Found. Tsavorite deletes are tombstone appends and never read the old record back, so for a disk-resident record status.Found == false even though the key logically exists. The failing 0 then propagated:

DeleteCallbackUnmanaged returns 0 → native remove != 1 → DiskANNService.Remove falseVectorManager.TryRemove -> MissingElementNetworkVREM writes :0.

The client could not distinguish this from "element was never there" — a data-correctness bug with no exception.

Fix

Return success on status.IsCompletedSuccessfully (dropping the && status.Found), matching the sibling Write/RMW callbacks which already only check IsCompletedSuccessfully.

Tests

Two layered regression tests, both forcing every record to disk via Log.FlushAndEvict first:

  • VREMOnDiskFlushedElementSucceeds — end-to-end over RESP: asserts VREM returns 1, a repeat returns 0, and a VSIM consistency check.
  • VREMOnDiskFlushedElement_ServiceRemoveSucceeds — lower-level: drives VectorManager.TryRemoveDiskANNService.Remove directly (bypassing RESP parsing/encoding and AOF replication), asserting VectorManagerResult.OK.

Verified before/after by toggling the fix:

Layer With fix Without fix
E2E (VREM) 1 Expected: 1, But was: 0
Service.Remove (TryRemove) OK Expected: OK, But was: MissingElement

Tiago Napoli and others added 3 commits July 21, 2026 11:59
…found

The DiskANN delete callback (DeleteCallbackUnmanaged) gated its return on
status.Found. Tsavorite deletes are tombstone appends that never read the old
record back, so for a record already flushed to disk status.Found is false even
though the key logically exists. That made the callback return 0, Service.Remove
return false, TryRemove report MissingElement, and VREM answer :0 (silently,
with no error) for any element that had been evicted to disk.

Return success on status.IsCompletedSuccessfully, matching the sibling
Write/RMW callbacks.

Adds two layered regression tests: an end-to-end VREM-over-RESP test and a
lower-level test that drives VectorManager.TryRemove/Service.Remove directly,
both forcing the element to disk via Log.FlushAndEvict first.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1030a670-b85f-41bb-b225-e2ddef5535eb
Drop the SeedVectorSetAndFlushToDisk helper in favor of three hardcoded VADD
VALUES calls plus an inline FlushAndEvict per test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1030a670-b85f-41bb-b225-e2ddef5535eb
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1030a670-b85f-41bb-b225-e2ddef5535eb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant