[Bug]: File descriptor exhaustion during segment rollover duplicates documents and leaves the collection unwritable
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Description
When creating the next writing segment fails, the old segment can remain both in the segment manager and in writing_segment_. stats() and query() then count its documents twice. Later inserts fail, and the broken state can survive a close and reopen. Some documents whose insert returned an error become visible through a forward scan after reopening.
switch_to_new_segment_for_writing() dumps the old segment and adds it to the segment manager before Segment::CreateAndOpen() creates its replacement. A replacement-creation failure returns without undoing either step. get_all_segments_unsafe() lists both owners.
Steps to Reproduce
Reproduced on unmodified 98aa126, macOS arm64, through the C++ API with default collection options:
- Create a collection with an inverted-indexed string field
clsand a plain integer fieldn. Insert 1,000 documents withcls = 'a'andn = 1, then close it. - Open it and lower the process's soft
RLIMIT_NOFILEto the number of open descriptors plus a small allowance. The verifier swept allowances from 4 to 30 in fresh processes. - Call
optimize(). Opening the new segment's scalar index fails withEMFILE("Too many open files"). Restore the descriptor limit. - Compare
stats().doc_countwith the row count and distinct primary keys fromquery(cls = 'a'). Try another insert and anotheroptimize(), then close and reopen. - Query both
cls = 'a'and the plain fieldn. Try more inserts and query their plain-field values.
Logs / Stack Trace
At allowance 4 on 98aa126:
optimize: Failed to open scalar indexer
stats().doc_count: 2000
query(cls = 'a'): 2000 rows, 1000 distinct primary keys
insert(x0): failed, empty error message
second optimize: Segment has been dumped.
close: OK
reopen: doc_count=1001, query(cls = 'a') returns 1000 rows
query(n = 7): returns x0, whose insert failed
insert(y0), insert(y1), insert(y2): failed, empty error messages
query(n = 101): returns y1, whose insert failed
Expected: a failed replacement creation leaves each acknowledged document visible once, does not publish a rejected insert, and permits writes and a rollover retry after resources are available. The same consistency must hold after reopening.
Operating System
macOS 27.0.1, arm64. Linux and Windows were not run.
Build & Runtime Environment
C++ API, Apple clang, CMake Release. The independent reproduction used unmodified 98aa126. The fix tests used the cached 98aa126 source with all six #790 files and the rollover addition checked byte-for-byte against the PR branch. Current main was not built because its unrelated RaBitQ 0.3.8 dependency was unavailable locally.
Additional Context
The fix creates the replacement before dumping the old segment, and adds the old segment to the segment manager only when the replacement is ready. It retires failed replacement creations through the existing segment lifecycle, leaves pre-existing conflicting directories untouched, and adds no on-disk format, public API or persistent structure.
A test-only RLIMIT_NOFILE regression covers rollover from a full-segment insert, optimize(), and create_index(). It checks two successive failed creations, cleanup of their unused directories, indexed queries, an unconditional forward scan after index creation, unique primary keys, retry, writes, and reopening. A seventh case checks the results of a batch whose rollover fails after a successful prefix. The updated regression fails all seven cases on 8944774 and passes all seven with the finished fix. The final targeted run passed 293 cases, including the seven regressions; one exhaustive manifest-truncation case timed out at 60 seconds, as it also did on unchanged 8944774. No timeout is counted as a pass. Linux and Windows were not run.
The fix is part of #790.
- 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