Dynamic Vamana `save()` always consolidates and compacts: full rewrite on every save, and failure when no entries are live
Mantenedores costumam responder em até 5 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 24/100
Direção de pesquisa
Start in include/svs/index/vamana/dynamic_index.h: save() calls consolidate() and compact() at about lines 1128 and 1161, and compact() at about line 904 does old_to_new_id_map.at(ep) at about line 1012, which throws when no points are live. Reproduce with the 10-point, delete-all, svs_index_save_stream sequence from the issue. Done means a save with zero live entries either succeeds and loads as an empty index, or fails with a clear error before any state changes. Coordinate the approach with maintainers first, since the issue also proposes a larger redesign of save.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Problem
MutableVamanaIndex::save begins with consolidate(); compact(); in both overloads: the directory one (include/svs/index/vamana/dynamic_index.h:1128) and the stream one (:1161). Both svs_index_save and svs_index_save_stream reach it, and since #406 the C API takes the index's write lock around the stream save (bindings/c/src/index_vamana.hpp:97-99). So a save is an exclusive mutation of the live index:
compact()(:904) rewrites every graph node (replace_node,:969,:981), compacts the data, resizes graph, data and status (:990), and remaps the translator (:1005). It does this even when no slot is deleted.- Searches on the index wait for the whole save. valkey-search reports about 1.2 s per 100k vectors for a foreground
SAVE/DEBUG RELOAD(valkey-search fork PR #19). - Embedders that snapshot through
fork()(e.g. valkey-search, where BGSAVE writes the RDB from a forked child) pay a copy-on-write fault on essentially every page of the index on every save. Peak memory during a save approaches twice the index size, and that peak arrives just as the process forks. - The cleanup also happens only in the child's copy. The parent keeps every deleted slot until it consolidates on its own.
Request
A save that doesn't change the index. Two options:
- Preferred: serialize only live entries through a temporary old-to-new id map, leaving graph, data and translator untouched. Callers could then save under shared/read access, and fork-based snapshots would only read memory.
- Minimal: in
save(), skipconsolidate()whenis_consolidated()(:893) is true, and skipcompact()when ids are already dense.DynamicIndexVamana::compactalready usesis_consolidated()this way. Callers could then compact on their own schedule (svs_index_dynamic_consolidate/svs_index_dynamic_compact), and saves of a clean index wouldn't write to it.
Related bug: save fails when every entry is deleted
If every point has been deleted (with no consolidation in between), save() throws, and the C API returns Couldn't find key.:
consolidate()(:1074) finds the entry point deleted and callscompute_entry_point(data_, threadpool_, valid)(:1087). With no valid points this falls back to a deleted slot;assert(!is_deleted(new_entry_point))would abort in a debug build.compact()then builds an emptyold_to_new_id_map, andep = old_to_new_id_map.at(ep)(:1012) throwsstd::out_of_range.
Repro, as reproduced from valkey-search's unit tests at 90c2aa0, which make exactly these C API calls: build a dynamic index with 10 points, svs_index_dynamic_delete_points all 10, then svs_index_save_stream. The call returns false with "Couldn't find key." The code path is unchanged at 8285340. valkey-search now works around this by not calling SVS save for an index with no live entries.
The expected behaviour is that saving an index with zero live entries either succeeds (producing an empty index on load) or fails with a clear error before any state is modified.
- Linguagem predominante
- C++
- Estrelas
- 241
- Forks
- 48
- Merge médio
- 4d 21h
- PRs com merge (30d)
- 11
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de intel/ScalableVectorSearch
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
intel/ScalableVectorSearch#356 ·
Mantenedores costumam responder em até 5 dias
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 42/100
intel/ScalableVectorSearch#469 ·
Mantenedores costumam responder em até 5 dias
-
Add CI test for C API on ARMAbertaenhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 32/100
intel/ScalableVectorSearch#460 ·
Mantenedores costumam responder em até 5 dias
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
intel/ScalableVectorSearch#438 ·
Mantenedores costumam responder em até 5 dias
-
CI: tier the test matrix into PR / main / nightly to cut Actions minutesTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 32/100
intel/ScalableVectorSearch#432 · 1 comentário ·
Mantenedores costumam responder em até 5 dias
Todas as issues de intel/ScalableVectorSearch
Issues semelhantes
-
runtime: lf_f128_mod is documented as fmodq (truncating) but implements floor-based modulo; unusedAbertainternal correctness low priority rt_lib
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 87/100
-
PriorityNotificationQueue::wakeUpAll() loses the wake-up for a thread that is not waiting yetTalvez já em andamento @matejk assumiu hoje. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
pocoproject/poco#5674 ·
Mantenedores costumam responder em até 2 dias
-
bug docs GUI
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
sonic-pi-net/sonic-pi#3609 ·
-
Unreachable code warningAbertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
SanderMertens/flecs#2395 ·
Mantenedores costumam responder em até 1 dia