Repository navigation
Limit IVF append metadata work to affected clusters - #145
Merged
Merged
Conversation
Group incoming IVF rows by touched cluster and keep each cluster's staging state together. Update only changed views and bound workers to the touched cluster count. Cover sparse interleaved appends and reserved storage with a rebuild-equivalence regression.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Appending even one vector currently allocates metadata for every IVF cluster and recreates every cluster view. This makes small appends pay a cost proportional to the total cluster count.
Group incoming rows by the clusters they touch, keep each cluster's staging storage and tail buffer with its append state, and refresh only the affected views. Cap quantization workers to the number of touched clusters while preserving row order, reserved-capacity reuse, and the strong exception guarantee.
Add a sparse, interleaved-cluster regression covering L2/IP and 1/4/32-bit storage, including reserved-pointer stability and byte-for-byte comparison with a full rebuild. Public APIs, saved-index formats, and dependencies are unchanged.
Testing
cmake --build <build> --target rabitq_tests --parallel 4, thenctest --test-dir <build> -R '^Ivf' --output-on-failure -j 2: 35 passed../scripts/check-format.sh,git diff --check, and./scripts/check-tidy.sh <build-tidy>: passed; clang-tidy 23 covered all configured first-party translation units.Matched append benchmarks against
main@841ca5e: deterministic synthetic float32 data, dimension 65, L2, fixed data/rotation seeds, Xeon Gold 6418H, GCC 14.3-O3 -DNDEBUG, native optimization OFF, runtime AVX-512, one thread pinned to CPU 16. OnlyIVF::addis timed; construction, loading, saving, and search are excluded.Each variant ran in four interleaved processes (ABBA repeated twice), with one warmup and 31 measured appends per process for the small case, or 15 for the batch case. Values below are the median and range of the four process medians.
Complete saved-index SHA-256 and search-result hashes match between main and the PR in both workloads. Batch timing ranges overlap on this shared host; they do not establish a general batch speedup.