Skip to content

Conversation

meiravgri
Copy link
Collaborator

@meiravgri meiravgri commented Oct 19, 2025

MOD-11910 Fix SVS Tiered index debug info thread count

Background

When SVS adds vectors in a multi-threaded environment:

  1. The system first attempts to reserve threads from the thread pool
  2. After reservation timeout, updateSVSIndex is called with the number of successfully reserved threads (which may be fewer than the total pool capacity)
  3. The thread count is temporarily adjusted via setNumThreads() for the addVectors operation
  4. The threapool size is not restored to the original pool capacity after the operation

Current Behavior

debugInfo() reports the thread count via getNumThreads(), which might have been modified by the last addVectors operation, instead of the actual thread pool capacity.

The Fix

  1. Fixed numThreads field: Now populated via getThreadPoolCapacity(), which reflects the configured capacity and not the temporarily modified value
  2. Added lastReservedThreads field: New field that reports the number of threads that were successfully reserved by the last ingestion operation, populated via getNumThreads()

MOD-11913 Increase threads' reservation timeout

Increased SVS_DEFAULT_UPDATE_JOB_WAIT_TIME: Changed from 0.1 ms to 5 ms to improve thread reservation reliability in multi-threaded scenarios

[Additional] Thread Management API Contract Enforcement For addVector/addVectors API

Background

The original SVS implementation had inconsistent thread management behavior:

  • Single vector operations (addVector) would temporarily set thread count to 1, then restore to the previous value
  • This restoration logic created inconsistencies when called through different code paths (tiered index writeInPlace mode when threadpool capacity >1 vs. async mode)

The Changes

  1. Removed automatic thread adjustment in addVectorsImpl: Eliminated the logic that automatically set thread count to 1 for single vector operations and then restored it
  2. Added API contract enforcement via assertions:
    • addVector(): Now requires numThreads == 1, enforced by assertion
    • addVectors(): Prohibits calling with n=1 when numThreads > 1, enforced by assertion
  3. Updated tiered index to respect the contract:
    • Write-in-place mode: Explicitly sets numThreads = 1 before calling addVector()
    • Async mode: Already properly manages thread count via existing setNumThreads() calls
  4. Updated test infrastructure: Modified CreateTieredSVSIndex to default numThreads = 1, allowing tests to call SVS methods directly while maintaining the single-thread contract

@meiravgri meiravgri changed the title get capcity instead of num that can be changed during addvector Fix SVS Tiered Index Debug Info Thread Count Oct 19, 2025
@meiravgri meiravgri changed the title Fix SVS Tiered Index Debug Info Thread Count [MOD-11910] Fix SVS Tiered Index Debug Info Thread Count Oct 19, 2025
Copy link

codecov bot commented Oct 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.86%. Comparing base (00bf35d) to head (26b35fb).

⚠️ Current head 26b35fb differs from pull request most recent head 5a7305e

Please upload reports for the commit 5a7305e to get more accurate results.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #808   +/-   ##
=======================================
  Coverage   96.86%   96.86%           
=======================================
  Files         126      126           
  Lines        7739     7740    +1     
=======================================
+ Hits         7496     7497    +1     
  Misses        243      243           

☔ 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.

@meiravgri meiravgri changed the title [MOD-11910] Fix SVS Tiered Index Debug Info Thread Count [MOD-11910] [MOD-11913] Fix SVS Tiered index debug info thread count and Increase threads' reservation timeout Oct 19, 2025
@meiravgri meiravgri changed the title [MOD-11910] [MOD-11913] Fix SVS Tiered index debug info thread count and Increase threads' reservation timeout [MOD-11910]Fix thread count report in SVS Tiered index debug info & [MOD-11913] Increase threads' reservation timeout Oct 19, 2025
@meiravgri meiravgri requested a review from alonre24 October 19, 2025 12:59
… index

limit addVector: should only be called with numThreads=1

limit addvectors: can be called with n ==1 only when numThreads ==1

enforce this change in tiered tests: set the num threads in the index to 1
alonre24
alonre24 previously approved these changes Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants