delete_all_data drops all indexes before clearing storage and hides rebuild failures
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_datareturns normally. The caller believes the collection was reset to an empty, usable state.
Steps to Reproduce
- Create a collection with one index and some data.
- Make
store_mgr.clear()raise, then calldelete_all_data(). - Catch the exception and run a search (or inspect the index map): the indexes were dropped and the collection answers with nothing.
- Alternatively, let the clear succeed and make
_new_indexraise 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.