[Bug]: After a crash during create_index on a scalar field, every retry fails with "Directory exists"
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Description
Building a scalar (inverted) index takes a new block id and copies the segment's scalar index RocksDB into scalar.index.<block id>.rocksdb with a RocksDB checkpoint:
The new block becomes visible only when the collection manifest that names it is published. If the process dies after the checkpoint directory exists and before that publish, the directory stays behind. On the next open, the block id allocator restarts from the blocks in the manifest:
So the retried create_index takes the same block id again, and RocksDB refuses to write a checkpoint into the existing directory:
[ERROR rocksdb_context.cc] Failed to create a checkpoint of Rocksdb[<collection>/0/scalar.index.1.rocksdb], code[4], reason[Invalid argument: Directory exists]
create_index fails at every retry. The collection still opens and serves reads, but the index can never be built, and the directory is never removed. The vector index path already handles this case for its index file ("possible crash residue; cleaning and overwriting"):
Steps to Reproduce
On 98aa126 (no source change; main at 7f54d94 does not change the files involved), macOS arm64:
- Create a collection with
max_doc_count_per_segment = 1000, three inverted-indexed fields and one plain INT32 fieldplain. Insert 1,001 documents (one sealed segment and a writing segment with one document) and close it. - In a child process, open it and call
create_index("plain", std::make_shared<InvertIndexParams>()). Kill the child with SIGKILL before its n-th file-system mutation below the collection directory, for every n. - After each kill, open the collection for writing; if
plainis not indexed, callcreate_indexagain.
We kill the child with a small preloaded library (DYLD_INSERT_LIBRARIES / LD_PRELOAD) that counts open-for-write, write, ftruncate, rename, unlink, mkdir, rmdir and fsync calls; it needs no hook in zvec. Of 664 kill points, the retry fails with "Directory exists" at 411: every point from 251 to 661. Point 250 is the RocksDB checkpoint's rename of 0/scalar.index.2.rocksdb.tmp to 0/scalar.index.2.rocksdb.
The same sweep also finds 54 points where the collection cannot be opened at all, from a separate seal defect (reported separately in #798). With that seal fix and a column-family creation change (#799) applied together, the index build makes 445 mutations, and the retry still fails with "Directory exists" at 309 of them (points 134 to 442).
Logs / Stack Trace
See above. create_index returns a non-OK Status with an empty message.
Operating System
macOS 27 (arm64). The code path is platform independent.
Build & Runtime Environment
Apple clang, CMake Release build of 98aa126.
Additional Context
Two possible fixes, either enough for this case:
- On a writable open, after the segments are opened, remove
scalar.index.<id>.rocksdbandfts.<id>.rocksdbdirectories (and their.tmpcheckpoint names) that the manifest does not reference. This extends the orphan-directory cleanup of #674 from segment directories to index directories, under the same exclusive lock. - Before the checkpoint, remove an existing directory at the new block's path, as the vector index path does for its file.
Earlier leftovers of the same kind were treated as bugs: #246 removes stale vector index files left by a crashed optimize, #674 removes orphaned segment directories that blocked id reuse, and #485 (for #427) removes the old scalar index directory on drop_index so create_index can be repeated. Only directories that the published manifest does not name would be removed, and zvec opens scalar and FTS indexes only from the blocks the manifest names, so no index zvec reads is affected.
I can open a PR with the first approach and the crash test if it is welcome.
- Lingua principale
- C++
- Stelle
- 16.3k
- Fork
- 1k
- Merge medio
- 2g 10h
- PR unite (30g)
- 32
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di alibaba/zvec
-
[Feature]: IVF_TIEREDQ index type, with a learned variable-bit codec (25–44% less index memory than `IVF_RABITQ` at equal recall)Forse già presa @richyreachy l’ha presa 7 giorni fa. Apertafeature
alibaba/zvec#909 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Support an opt-in portable x86 FastPFOR build without SSE4.1Forse già presa @egolearner l’ha presa 20 giorni fa. Aperta
alibaba/zvec#875 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Enhance]: Reduce vector index block fragmentation caused by frequent flushesForse già presa @feihongxu0824 l’ha presa 22 giorni fa. Apertaenhancement
alibaba/zvec#869 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Performance]:High-selectivity range filter materializes a full bitmap — `bitset_set_list` ~49% CPU, dwarfing the ANN searchForse già presa @zhourrr l’ha presa 22 giorni fa. Apertaenhancement
alibaba/zvec#868 · 13 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Performance] Warm-query latency on small collections with query() and query_internal_ids() in v0.8.0Forse di nuovo libera @egolearner l’ha presa 33 giorni fa e non c’è nessuna pull request aperta. Aperta
alibaba/zvec#841 · 2 assegnatari ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di alibaba/zvec
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
deepseek-ai/DeepEP#839 ·
I maintainer di solito rispondono entro 6 giorni
-
multilabel_margin_loss returns an unwritten scalar for an empty CPU batch with reduction='sum'Apertabot-triaged module: correctness (silent) module: cpu module: empty tensor module: loss triage review
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
stephenberry/glaze#3126 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ultravideo/kvazaar#453 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
google-ai-edge/LiteRT-LM#4783 ·
I maintainer di solito rispondono entro 1 giorno