[SVS][PoC] 2-steps vectors update in SVSTiered#988
Conversation
| svs_index->setParallelism(std::min(availableThreads, labels_to_move.size())); | ||
| svs_index->addVectors(vectors_to_move.data(), labels_to_move.data(), | ||
| labels_to_move.size()); | ||
| svs_index->applyAddVectorsChanges(std::move(changes)); |
There was a problem hiding this comment.
Backend deletes under shared lock
High Severity
updateSVSIndex calls makeAddVectorsChanges while holding only a shared mainIndexGuard lock, but that path still runs deleteVectorsImpl (via impl_->delete_entries) before the exclusive lock and applyAddVectorsChanges. Concurrent backend searches also use shared locks, so they can observe deleted labels and a mutating graph before new points are committed.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit ba22610. Configure here.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #988 +/- ##
==========================================
- Coverage 97.12% 97.05% -0.07%
==========================================
Files 141 141
Lines 8164 8225 +61
==========================================
+ Hits 7929 7983 +54
- Misses 235 242 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c81cfa8. Configure here.
| if constexpr (!isMulti) { | ||
| // SVS index does not support overriding vectors with the same label | ||
| // so we have to delete them first if needed | ||
| deleted_num = deleteVectorsImpl(labels, n); |
There was a problem hiding this comment.
Index deletes under shared lock
High Severity
makeAddVectorsChanges calls deleteVectorsImpl, which mutates the SVS backend via delete_entries and markIndexUpdate. Tiered updateSVSIndex invokes this while holding only a shared mainIndexGuard, so concurrent topKQuery paths can read the same impl_ and race with those writes.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit c81cfa8. Configure here.


Proof-of-concept for 2-steps SVS index update
This PR is the PoC to demonstrate potential Tiered SVS index update performance improvements by using 2-steps index update capability implemented in intel/ScalableVectorSearch#348.
Which issues this PR fixes
Main objects this PR modified
Mark if applicable
Note
Medium Risk
Changes tiered update locking and SVS search/add integration against new prebuilt libraries; incorrect two-phase ordering or ID translation could affect correctness under concurrent queries.
Overview
PoC for shorter exclusive locks during tiered SVS flushes by splitting backend inserts into compute-then-commit using SVS
add_points_compute_changes/add_points_commit, wired through newSVSIndexBase::makeAddVectorsChangesandapplyAddVectorsChanges.TieredSVSIndex::updateSVSIndexnow runs vector preprocessing and change computation while holding only a sharedmainIndexGuard, then upgrades to an exclusive lock solely forapplyAddVectorsChangesinstead of callingaddVectorsunder the writer lock for the whole operation.For non-multi SVS indices, single-query TopK avoids the batch
QueryResultsearch API and usesMutableVamanaIndexscratchspace search withtranslate_internal_idon neighbors.Build:
cmake/svs.cmakepoints prebuilt SVS downloads at nightly pr330 tarballs, collapses Clang libstdc++ selection to GCC 11+, drops the glibc 2.26 GCC binary path, and raises the minimum glibc for GCC prebuilts to 2.28.Benchmarks: adds
BM_TopKSearchDuringUpdateto stress parallel TopK queries during a background tiered update.Reviewed by Cursor Bugbot for commit c81cfa8. Bugbot is set up for automated code reviews on this repo. Configure here.