[C API] Feature request: expose block-growth headroom for a dynamic index
维护者通常 5 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start in bindings/c/include/svs/c/svs_c.h beside svs_index_get_memory_usage and svs_index_get_memory_breakdown, then trace the dynamic index implementation in dynamic_index.h and its resize/unsafe_resize paths. Add the read-only API and verify it reports capacity minus size for dynamic indices, returns zero for unsupported indices, and preserves the documented error-handling shape.
由索引模型根据 Issue 内容生成。
描述
Problem
A dynamic index's memory reservation is tracked as committed capacity, not live occupancy. add_points grows data_/graph_/status_ in blocks (dynamic_index.h, resize/unsafe_resize calls), so a block often has spare rows left over after a resize. Committed capacity therefore overstates how many bytes an insert will actually consume.
An insert-admission gate that enforces a memory budget needs to know how much of that committed capacity is still unoccupied headroom, so it can allow an insert that would land in already-allocated spare rows and cost zero real bytes. Without that visibility, the gate must charge a fixed conservative growth cost per insert, and near the budget limit it refuses inserts that would not have grown memory at all.
What is needed is a cheap way to read how many rows of spare capacity a dynamic index currently has, without walking the graph.
Requested API
Add a new C API call, alongside the existing memory-usage family (svs_index_get_memory_usage, svs_index_get_memory_breakdown in bindings/c/include/svs/c/svs_c.h):
/// @brief Get the unused row capacity of a dynamic index before its next
/// internal block resize
/// @param index The index handle
/// @param out_vectors Pointer to store the number of rows of headroom
/// @param out_err An optional error handle to capture errors
/// @return true on success, false on failure
/// @remarks O(1). Reads capacity() - size() off the dynamic index's
/// blocked dataset. Returns 0 for indices that do not support dynamic
/// growth (e.g. static/read-only indices).
SVS_API bool svs_index_get_capacity_headroom(
svs_index_h index, size_t* out_vectors, svs_error_h out_err /*=NULL*/
);
Why this shape
- Mirrors the existing
svs_index_get_memory_usage/svs_index_get_memory_breakdownsignatures and doc-comment style, so it fits the current API family added for PR #364. - Returns a row count, not bytes. The caller already knows per-row byte cost from its own dimension/element-size config; a row count avoids duplicating SVS's internal block-size math on the caller side. A byte count works too, if that fits the existing memory-usage API family better; the caller can convert either way.
- O(1): a
capacity() - size()read, no graph walk.
Non-goals
- Does not need to account for
Deletedslots.delete_entrymarks a slotDeleted, notEmpty(dynamic_index.h), andadd_points's reuse scan only matchesEmpty(dynamic_index.h:752). Onlycompact()turnsDeletedback into usable capacity, so headroom from block growth and headroom from delete/compact are different numbers; this request is only for the former. - No behavior change to
add_points,resize, orcompactis being requested; this is a read-only accessor.
- 主要语言
- C++
- 星标
- 241
- 派生
- 48
- 平均合并
- 4 天 21 小时
- 30 天内合并 PR
- 11
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
intel/ScalableVectorSearch 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
intel/ScalableVectorSearch#356 ·
维护者通常 5 天内回复
-
难度 4/5 3-5 天 新手友好度 42/100
intel/ScalableVectorSearch#469 ·
维护者通常 5 天内回复
-
enhancement
难度 3/5 1-2 天 新手友好度 32/100
intel/ScalableVectorSearch#460 ·
维护者通常 5 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
intel/ScalableVectorSearch#438 ·
维护者通常 5 天内回复
-
CI: tier the test matrix into PR / main / nightly to cut Actions minutes可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 5/5 一周以上 新手友好度 32/100
intel/ScalableVectorSearch#432 · 1 条评论 ·
维护者通常 5 天内回复
查看 intel/ScalableVectorSearch 的全部 Issue
相似的 Issue
-
runtime: lf_f128_mod is documented as fmodq (truncating) but implements floor-based modulo; unused未关闭internal correctness low priority rt_lib
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 87/100
-
PriorityNotificationQueue::wakeUpAll() loses the wake-up for a thread that is not waiting yet可能已有人在做 @matejk 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
pocoproject/poco#5674 ·
维护者通常 2 天内回复
-
bug docs GUI
难度 2/5 1-3 小时 新手友好度 62/100
sonic-pi-net/sonic-pi#3609 ·
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
SanderMertens/flecs#2395 ·
维护者通常 1 天内回复