Skip to content

[MOD-17675] Refactor addVector to support reuse flows - #1079

Open
nonirosenfeldredis wants to merge 1 commit into
mainfrom
MOD-17675
Open

nonirosenfeldredis wants to merge 1 commit into
mainfrom
MOD-17675

Conversation

@nonirosenfeldredis

@nonirosenfeldredis nonirosenfeldredis commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Split TieredHNSWIndex::addVector into addVectorInPlace and addVectorToFlat (private helpers), leaving addVector as the dispatcher.
  • Move the single-value branch of updateVectors into updateVectorSingleValue, and flatten the multi-value reuse branches.
  • Behavior fix: a single-value updateVectors(label, nullptr, 0) now removes the label (as before the refactor) instead of inserting from a null blob.

Test plan

  • New test updateVectorsSingleValueZeroVectorsRemovesLabel (async + in-place); verified it crashes without the n == 0 guard.
  • Tiered HNSW suite (299 tests) passes on release/macOS, seeds 1-5.
  • CI (libstdc++), debug/ASAN builds

🤖 Generated with Claude Code


Note

Medium Risk
Touches core tiered HNSW insert/update/delete and async job submission paths; the n==0 fix is localized but insertion refactor affects all add/update entry points.

Overview
Refactors tiered HNSW vector insertion and update so reuse / id-reservation flows are easier to follow, without changing the overall tiering model.

addVector is now a thin dispatcher: write-in-place work lives in addVectorInPlace, and flat-buffer enqueue + insert-job creation lives in addVectorToFlat. updateVectors on single-value indexes delegates to new updateVectorSingleValue, which handles n > 1, n == 0, and the single-vector overwrite via addVector. Multi-value reuse paths are grouped under one reuseIdOnUpdate && !sqAccumulationState guard (in-place first, then async when n > 0).

Behavior fix: updateVectors(label, nullptr, 0) on a single-value index removes the label instead of treating a null blob as an overwrite. A unit test covers async (flat) and in-place (HNSW) cases.

Reviewed by Cursor Bugbot for commit 152c478. Bugbot is set up for automated code reviews on this repo. Configure here.

Split addVector into addVectorInPlace and addVectorToFlat, and move the
single-value branch of updateVectors into updateVectorSingleValue. A
single-value update with zero vectors now removes the label instead of
inserting from a null blob.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.57%. Comparing base (0348684) to head (152c478).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1079      +/-   ##
==========================================
- Coverage   97.58%   97.57%   -0.01%     
==========================================
  Files         142      142              
  Lines        9444     9455      +11     
==========================================
+ Hits         9216     9226      +10     
- Misses        228      229       +1     

☔ View full report in Codecov by Harness.
📢 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.

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.

1 participant