[Bug]: After a crash during create_index on a scalar field, every retry fails with "Directory exists"
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
- Ngôn ngữ chính
- C++
- Star
- 16.3k
- Fork
- 1k
- Merge trung bình
- 2 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 32
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của alibaba/zvec
-
[Feature]: IVF_TIEREDQ index type, with a learned variable-bit codec (25–44% less index memory than `IVF_RABITQ` at equal recall)Có thể đã có người làm @richyreachy đã nhận 7 ngày trước. Đang mởfeature
alibaba/zvec#909 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support an opt-in portable x86 FastPFOR build without SSE4.1Có thể đã có người làm @egolearner đã nhận 20 ngày trước. Đang mở
alibaba/zvec#875 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Enhance]: Reduce vector index block fragmentation caused by frequent flushesCó thể đã có người làm @feihongxu0824 đã nhận 22 ngày trước. Đang mởenhancement
alibaba/zvec#869 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Performance]:High-selectivity range filter materializes a full bitmap — `bitset_set_list` ~49% CPU, dwarfing the ANN searchCó thể đã có người làm @zhourrr đã nhận 22 ngày trước. Đang mởenhancement
alibaba/zvec#868 · 13 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Performance] Warm-query latency on small collections with query() and query_internal_ids() in v0.8.0Có thể làm lại được @egolearner đã nhận 33 ngày trước và không có pull request nào đang mở. Đang mở
alibaba/zvec#841 · 2 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
-
deprecation internal refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
realloc(ptr, 0) on glibc leaves the freed block in the capture as a leakCó thể đã có người làm @ADAMAMZAR đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
bloomberg/memray#1097 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
new-compilers request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
compiler-explorer/compiler-explorer#9640 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
deepseek-ai/DeepEP#839 ·
Maintainer thường phản hồi trong vòng 6 ngày