Skip to content

[diskann-garnet] Fix cache coherence on set_neighbors#1230

Open
metajack wants to merge 1 commit into
mainfrom
push-ozypywsxqmsv
Open

[diskann-garnet] Fix cache coherence on set_neighbors#1230
metajack wants to merge 1 commit into
mainfrom
push-ozypywsxqmsv

Conversation

@metajack

@metajack metajack commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

When diagnosing some issues last week I realized that there was a cache coherency problem with set_neighbors(). append_vector() updates the start point neighbor cache atomically alongside the real neighbor list, but set_neighbors() did two writes sequentially which could result in coherency issues.

As far as I'm aware, this did not cause any actual problems, but it was easy enough to make it coherent by using RMW instead in set_neighbors().

@metajack metajack requested review from a team and Copilot July 6, 2026 19:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a cache-coherency window in diskann-garnet where set_neighbors() updated Garnet storage and the start-point neighbor cache via two separate operations. It aligns set_neighbors() with the existing append_vector() pattern by performing the update via a read-modify-write (RMW) callback, and bumps the crate/package version to reflect the fix.

Changes:

  • Update GarnetProvider::set_neighbors() to use Callbacks::rmw_iid() and update the start-point neighbor cache within the same RMW operation.
  • Standardize error returns to GarnetError::Write.into() for write failures in the modified code paths.
  • Bump diskann-garnet version from 3.0.0 to 3.0.1 across Rust and NuGet packaging metadata.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
diskann-garnet/src/provider.rs Switch set_neighbors() to an RMW update to avoid cache/storage coherence windows; minor error return normalization.
diskann-garnet/diskann-garnet.nuspec Bump NuGet package version to 3.0.1.
diskann-garnet/Cargo.toml Bump crate version to 3.0.1.
Cargo.lock Update lockfile entry for diskann-garnet to 3.0.1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter

codecov-commenter commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.71%. Comparing base (9123eb5) to head (afe5890).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
diskann-garnet/src/provider.rs 83.33% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1230      +/-   ##
==========================================
+ Coverage   89.64%   89.71%   +0.07%     
==========================================
  Files         503      503              
  Lines       95761    96009     +248     
==========================================
+ Hits        85845    86139     +294     
+ Misses       9916     9870      -46     
Flag Coverage Δ
miri 89.71% <83.33%> (+0.07%) ⬆️
unittests 89.38% <83.33%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
diskann-garnet/src/provider.rs 74.80% <83.33%> (+0.09%) ⬆️

... and 10 files with indirect coverage changes

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

@harsha-simhadri

Copy link
Copy Markdown
Contributor

Could you share before and after perf numbers? Perhaps we should make it easier to run some of these going forward

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.

5 participants