mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-25 21:15:47 +00:00
Fixed corrupted vector stores after switching between versions of AI Studio (#1231)
This commit is contained in:
1 parent
00e53f5a8a
commit
5adf4ee757
5 files changed
+260
-32
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
- Status: Active
|
||||
- Introduced: 2026-11-24
|
||||
- Remove after: when a qdrant-edge release skips the operations of the WAL which its segments already persisted when it loads a store
|
||||
- Remove after: when a qdrant-edge release skips the operations of the WAL which its segments already persisted when it loads a store, see [qdrant/qdrant#11732](https://github.com/qdrant/qdrant/issues/11732)
|
||||
- Code references:
|
||||
- `runtime/src/qdrant_edge_database.rs` (`acknowledge_legacy_wal`, `WAL_FIRST_INDEX_FILE`, `WAL_FIRST_INDEX_FILE_TEMP`)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
Up to qdrant-edge 0.8.0, Qdrant Edge wrote every update of a vector store to its write-ahead log (WAL), but never acknowledged the WAL. Since 0.9.0, loading a store applies every operation of the WAL again which is not marked as acknowledged. The first load of a store written by an older version of AI Studio therefore applies its whole WAL once more.
|
||||
|
||||
That WAL holds thousands of operations. Each deletion of a document in there reads and parses every payload of the store, because the fields it filters on have no payload index. For a real store of 317 MB with 20,316 operations in its WAL, the first load had not finished after more than 12 minutes. Meanwhile, every request to the vector database waits, and when the user quits AI Studio before the load is done, the next start begins again.
|
||||
That WAL holds thousands of operations. Each deletion of a document in there reads and parses every payload of the store, because the fields it filters on have no payload index. For a real store of 317 MB with 20,316 operations in its WAL, the first load had not finished after 39 minutes. Meanwhile, every request to the vector database waits, and when the user quits AI Studio before the load is done, the next start begins again.
|
||||
|
||||
## Compatibility Behavior
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Qdrant Edge Tracker Journal
|
||||
|
||||
- Status: Active
|
||||
- Introduced: 2026-11-25
|
||||
- Remove after: 2027-05-25, once organizations no longer go back to AI Studio v26.11.1 or older, the last versions with qdrant-edge 0.8
|
||||
- Code references:
|
||||
- `runtime/src/qdrant_edge_database.rs` (`remove_tracker_journals`, `tracker_journals`, `TRACKER_JOURNAL_FILE`, `unload_store`, `Drop for QdrantEdgeDatabase`)
|
||||
|
||||
## User Impact
|
||||
|
||||
Since qdrant-edge 0.9.0, every storage of a vector store notes its pointer writes in the file `tracker_journal.dat` before it writes them, and applies this journal again whenever it opens, which repairs pointers a crash tore during a flush. After a flush, Qdrant Edge keeps the journal until it holds about 1,000 writes. qdrant-edge 0.8.0, which AI Studio v26.11.1 and older use, knows no journal and leaves it alone.
|
||||
|
||||
Someone may go back from a newer version of AI Studio to v26.11.1 or older, e.g., because their organization rolls back an update, or because a developer runs a development build and the installed release on the same data directory. When the older version then writes to a store, e.g., while it indexes a changed file, the journal still holds the pointers from before. The next load under qdrant-edge 0.9 sets them again, so they point into freed blocks. In a test with a real store of 318 MB, loading the store then failed with "Failed to decompress LZ4 value", or Qdrant Edge panicked while it applied the WAL. Either way, the store is lost until its embeddings are rebuilt.
|
||||
|
||||
## Compatibility Behavior
|
||||
|
||||
Whenever AI Studio unloads a store, it flushes it, closes it, and then removes every `tracker_journal.dat` below the store's directory. AI Studio unloads every store when it quits, installs an update, or restarts after restoring a backup, and it unloads a store before copying it into a backup, so backups contain no journal either. After a successful flush, the journal has nothing left to repair. When the flush fails, AI Studio keeps the store loaded and leaves its journals in place, since Qdrant Edge then still needs them.
|
||||
|
||||
When the operating system ends AI Studio without letting it quit, the journals stay. The next start of a version with qdrant-edge 0.9 applies them, which repairs what the crash may have torn, and AI Studio removes the journals again when it unloads the store. Only going back to an older version right after such a hard end can still break a store.
|
||||
|
||||
In the test, removing the journals before the older version wrote to the store, or before the newer version loaded it again, kept all payloads, filters, and points intact.
|
||||
|
||||
## Removal Checklist
|
||||
|
||||
- Remove `remove_tracker_journals`, `tracker_journals`, and the constant `TRACKER_JOURNAL_FILE`.
|
||||
- Remove the call of `remove_tracker_journals` from `unload_store`. Keep `unload_store` and `Drop for QdrantEdgeDatabase` only if they still do more than flushing and closing the stores, which dropping a shard does by itself.
|
||||
- Remove the tests `unloading_a_store_removes_its_tracker_journals_and_keeps_its_points` and `a_backup_copies_a_store_without_its_tracker_journals`.
|
||||
- Update this document's status to `Removed`.
|
||||
Reference in new issue
Block a user