OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

delete_all_data drops all indexes before clearing storage and hides rebuild failures

Open Kiko0301 opened this issue 3 weeks ago • 0 comments

delete_all_data drops all indexes before clearing storage and hides rebuild failures

Bug Description

LocalCollection.delete_all_data (openviking/storage/vectordb/collection/local_collection.py) resets a collection in four steps: read index metadata (logging and skipping any failure), drop every index, clear the store, then rebuild empty indexes (logging and swallowing every failure).

The order makes both failure modes destructive:

  • If store_mgr.clear() fails, all indexes have already been dropped. The exception propagates, but the collection now has no indexes, so every subsequent search answers with an empty result.
  • If an index rebuild fails, the collection is missing that index and delete_all_data returns normally. The caller believes the collection was reset to an empty, usable state.

Steps to Reproduce

  1. Create a collection with one index and some data.
  2. Make store_mgr.clear() raise, then call delete_all_data().
  3. Catch the exception and run a search (or inspect the index map): the indexes were dropped and the collection answers with nothing.
  4. Alternatively, let the clear succeed and make _new_index raise for one index: delete_all_data() returns without error while that index is missing.

Expected Behavior

A failure before any mutation aborts the reset and leaves the collection intact. A storage-clear failure does not drop the indexes. Rebuild failures are reported to the caller after every index has been attempted.

Actual Behavior

The collection is left without indexes in both cases; the rebuild failure is swallowed and reported as success.

Environment

  • OS: Windows 11
  • OpenViking version/commit: main @ 37a74437

Additional Context

Fix submitted as PR #7565: metadata is read first and a failure aborts before mutation, store_mgr.clear() runs before any index.drop(), and rebuild failures are collected and raised after all indexes are attempted. Three regression tests (clear failure keeps indexes, rebuild failure is reported, clear-before-drop ordering) all fail on unmodified main and pass with the fix.

Kiko0301 avatar Nov 13 '26 12:11 Kiko0301