Skip to content

Conversation

@rfsaliev
Copy link
Collaborator

@rfsaliev rfsaliev commented Feb 2, 2026

Purpose: prevent long time SVS Tiered index lock at initialization time.

Logic:

  • First stage: create svs::...::MutableVamanaIndex instance with R/O shared lock
  • Second stage: set svs::...::MutableVamanaIndex created before under R/W unique lock

Which issues this PR fixes

  1. #7831

Main objects this PR modified

  1. 2 methods added to SVSIndex: createImpl() and setImpl()
  2. SVSTiered update job is modified to call createImpl() under shared lock and setImpl() under unique lock if backend index is empty.

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Purpose: prevent long time SVS Tiered index lock at initialization time.
Logic:
 First stage: create `svs::...::MutableVamanaIndex` instance with R/O shared lock
 Second stage: set `svs::...::MutableVamanaIndex` created before under R/W unique lock
@jit-ci
Copy link

jit-ci bot commented Feb 2, 2026

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

@codecov
Copy link

codecov bot commented Feb 2, 2026

Codecov Report

❌ Patch coverage is 96.55172% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.08%. Comparing base (bd3769b) to head (616b4ba).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/VecSim/algorithms/svs/svs.h 94.11% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #903      +/-   ##
==========================================
- Coverage   97.09%   97.08%   -0.01%     
==========================================
  Files         129      129              
  Lines        7493     7541      +48     
==========================================
+ Hits         7275     7321      +46     
- Misses        218      220       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@alonre24 alonre24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
A few small comments.
Also please:

  1. Validate that covering the affected scenarios in unit tests (I believe we are)
  2. Add micro benchmarks that will prove the improvement (add vector/run query while initial index creation is executed in the background)

}

void setImpl(std::unique_ptr<ImplHandler> handler) override {
assert(handler && "SVSIndex::setImpl called with null handler");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a debug-only assert, let's add this to the log in a warning level as well

Comment on lines +233 to +238
std::span<const labelType> ids(labels, n);
auto processed_blob = this->preprocessForBatchStorage(vectors_data, n);
auto typed_vectors_data = static_cast<DataType *>(processed_blob.get());
// Wrap data into SVS SimpleDataView for SVS API
auto points = svs::data::SimpleDataView<DataType>{typed_vectors_data, n, this->dim};

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic seems to be a duplication of what we do in addVectorsImpl. Consider unifying these into a single function

Comment on lines +249 to +252
SVSImplHandler *svs_handler = dynamic_cast<SVSImplHandler *>(handler.get());
if (!svs_handler) {
throw std::logic_error("Failed to cast to SVSImplHandler");
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the motivation to have an abstract ImplHandler rather than have only SVSImplHandler? The dynamic_cast here seems a bit awkward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants