[C API] Reuse slots freed by consolidate in svs_index_dynamic_add_points
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
- 55/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- cpp
- Domínio
- backend, performance
Direção de pesquisa
Read include/svs/index/vamana/dynamic_index.h around add_points, consolidate, and the first_empty_ TODO, then trace the C API add path in bindings/c/src/index_vamana.cpp. Compare the proposed reuse approaches and check how they avoid an O(N) scan per add. Done means consolidated slots are reused through the C API without that per-add scan; review existing dynamic-index tests for coverage.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary
Through the C API, slots freed by svs_index_dynamic_consolidate are never reused by svs_index_dynamic_add_points, so a dynamic index that sees deletes or updates keeps growing until it is compacted. Please make consolidated slots reusable by the C API's add path.
Details (at cde3771)
delete_entriesmarks slotsDeleted;consolidate()repairs the graph and turns themEmpty(include/svs/index/vamana/dynamic_index.h:1105-1108).add_pointslooks forEmptyslots starting atreuse_empty ? 0 : first_empty_(dynamic_index.h:772).first_empty_only moves up (:843) and is reset only bycompact()(:992). The constructor carries a TODO about this logic (:369-372).- The C++ orchestrator exposes
reuse_empty(include/svs/orchestrators/dynamic_vamana.h:80), but the C API'sDynamicIndexVamana::add_pointscallsindex.add_points(new_points, ids)without it (bindings/c/src/index_vamana.cpp:187), andsvs_index_dynamic_add_pointshas no way to request it.
So through the C API, consolidation repairs search but doesn't stop growth: every add after a delete appends a new slot.
Measured (valkey-search, ALGORITHM SVS_VAMANA)
2,000 vectors, DIM 128, then 100k updates (each a delete plus an add):
| Memory after churn | Search latency after churn | |
|---|---|---|
| No consolidation | 104 MiB (from 26 MiB) | 3.87 ms |
| Consolidate only | 104 MiB | 0.75 ms |
| Consolidate + compact | 26 MiB | 0.92 ms |
To bound memory we currently run svs_index_dynamic_compact after every consolidation. That copies every live vector and rewrites the graph, under an exclusive lock.
Ask
Let the C API's add path reuse slots that consolidation freed, without an O(N) scan per add. For example:
- Have
consolidate()lowerfirst_empty_to the first slot it freed, so the defaultadd_pointspath reuses them (this looks like what the TODO at:369-372is about); or - Expose
reuse_emptyin the C API (a parameter onsvs_index_dynamic_add_points, or a dynamic-index option). As implemented it rescans from slot 0 on every add, though, which would cost append-heavy workloads.
With either, valkey-search would consolidate only, and compact only when it wants memory back.
Consumer context
valkey-search builds SVS from the C API submodule, pinned at cde3771. The consolidate + compact workaround is eshenayo/valkey-search#24.
- 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
-
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
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
intel/ScalableVectorSearch#427 ·
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