Skip to content

Conversation

@meiravgri
Copy link
Collaborator

@meiravgri meiravgri commented Nov 2, 2025

The UpdateAtBlockSize benchmark contained an incorrect assertion that expected metadata containers to shrink by exactly one block size during delete operations:

assert(index->indexCapacity() == index_cap - BM_VecSimGeneral::block_size);

Why it was broken

  1. For Flat indexes: After PR [MOD-10559] Decouple the shrinking and growing logic of large containers in Flat and HNSW #753's conservative resize strategy, metadata containers (idToLabelMapping) only shrink when indexCapacity() >= (indexSize() + 2 * blockSize), not at exact blocksize boundaries
  2. For HNSW indexes: indexCapacity() returns the capacity of vector containers, not metadata containers. While the assertion didn't fail, it was testing vector container capacity instead of the intended metadata container capacity, making it ineffective at validating the benchmark's actual purpose

What was fixed

  • Introduced indexMetaDataCapacity() method: Returns the actual capacity of metadata containers (idToLabelMapping for Flat, idToMetaData for HNSW, combined capacities for tiered indexes)
  • Updated benchmark assertions: Changed from expecting capacity reduction to verifying capacity stability during delete/add cycles, which correctly tests the conservative resize behavior introduced in PR [MOD-10559] Decouple the shrinking and growing logic of large containers in Flat and HNSW #753

@meiravgri meiravgri marked this pull request as draft November 2, 2025 12:12
@codecov
Copy link

codecov bot commented Nov 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.66%. Comparing base (9f1fc61) to head (f2b936c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #819   +/-   ##
=======================================
  Coverage   96.66%   96.66%           
=======================================
  Files         126      126           
  Lines        7368     7379   +11     
=======================================
+ Hits         7122     7133   +11     
  Misses        246      246           

☔ 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 VecSimIndexInterface: introduce indexMetaDataCapacity for testing Fix incorrect assertion in BM_VecSimBasics::UpdateAtBlockSize benchmark Nov 2, 2025
@meiravgri meiravgri marked this pull request as ready for review November 2, 2025 12:40
@meiravgri meiravgri requested a review from alonre24 November 2, 2025 12:41
@meiravgri meiravgri enabled auto-merge November 2, 2025 13:08
Comment on lines +252 to +253
return this->backendIndex->indexMetaDataCapacity() +
this->frontendIndex->indexMetaDataCapacity();
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to lock here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i took reference from indexCapacity()

Copy link
Collaborator Author

@meiravgri meiravgri Nov 2, 2025

Choose a reason for hiding this comment

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

from what i see indexCapacity() is also only used for testing

Comment on lines +514 to +519
size_t indexMetaDataCapacity() const override {
std::shared_lock<std::shared_mutex> flat_lock(this->flatIndexGuard);
std::shared_lock<std::shared_mutex> main_lock(this->mainIndexGuard);
return this->frontendIndex->indexMetaDataCapacity() +
this->backendIndex->indexMetaDataCapacity();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this be moved to tiered_index.h?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same

@meiravgri meiravgri requested a review from GuyAv46 November 3, 2025 09:04
@meiravgri meiravgri added this pull request to the merge queue Nov 3, 2025
Merged via the queue into main with commit f24b65a Nov 3, 2025
38 of 40 checks passed
@meiravgri meiravgri deleted the meiravg_fix_bm_capacity_asserts branch November 3, 2025 12:49
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Backport failed for 0.6, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 0.6
git worktree add -d .worktree/backport-819-to-0.6 origin/0.6
cd .worktree/backport-819-to-0.6
git switch --create backport-819-to-0.6
git cherry-pick -x f24b65afa98f99352f7c1f384e24f2c2a4cbaad1

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Backport failed for 0.7, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 0.7
git worktree add -d .worktree/backport-819-to-0.7 origin/0.7
cd .worktree/backport-819-to-0.7
git switch --create backport-819-to-0.7
git cherry-pick -x f24b65afa98f99352f7c1f384e24f2c2a4cbaad1

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Backport failed for 0.8, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 0.8
git worktree add -d .worktree/backport-819-to-0.8 origin/0.8
cd .worktree/backport-819-to-0.8
git switch --create backport-819-to-0.8
git cherry-pick -x f24b65afa98f99352f7c1f384e24f2c2a4cbaad1

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Backport failed for 8.2, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 8.2
git worktree add -d .worktree/backport-819-to-8.2 origin/8.2
cd .worktree/backport-819-to-8.2
git switch --create backport-819-to-8.2
git cherry-pick -x f24b65afa98f99352f7c1f384e24f2c2a4cbaad1

meiravgri added a commit that referenced this pull request Nov 4, 2025
…mark (#819)

* VecSimIndexInterface: introduce indexMetaDataCapacity for testing
returns metadata containers capacity

* cover for tiered index

(cherry picked from commit f24b65a)
meiravgri added a commit that referenced this pull request Nov 4, 2025
…mark (#819)

* VecSimIndexInterface: introduce indexMetaDataCapacity for testing
returns metadata containers capacity

* cover for tiered index

(cherry picked from commit f24b65a)
meiravgri added a commit that referenced this pull request Nov 4, 2025
…mark (#819)

* VecSimIndexInterface: introduce indexMetaDataCapacity for testing
returns metadata containers capacity

* cover for tiered index

(cherry picked from commit f24b65a)
github-merge-queue bot pushed a commit that referenced this pull request Nov 4, 2025
… benchmark (#824)

* Fix incorrect assertion in `BM_VecSimBasics::UpdateAtBlockSize` benchmark (#819)

* VecSimIndexInterface: introduce indexMetaDataCapacity for testing
returns metadata containers capacity

* cover for tiered index

(cherry picked from commit f24b65a)

* Uncomment include for bm_basics_initialize_fp32.h
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.

3 participants