Skip to content

Remove the owned runtime and synchronous DiskIndexSearcher API - #1388

Open
Wei Wu (wuw92) wants to merge 2 commits into
mainfrom
wuw92-issue-1330-async-search
Open

Remove the owned runtime and synchronous DiskIndexSearcher API#1388
Wei Wu (wuw92) wants to merge 2 commits into
mainfrom
wuw92-issue-1330-async-search

Conversation

@wuw92

@wuw92 Wei Wu (wuw92) commented Sep 9, 2026

Copy link
Copy Markdown
Contributor
  • Does this PR have a descriptive title that could go in our release notes?
  • Does this PR add any new dependencies? No.
  • Does this PR modify any existing APIs?
  • Is the change to the API backwards compatible? No; callers must remove the runtime constructor argument and await searches or drive them with their own executor.
  • Should this result in any changes to our documentation, either updating existing docs or adding new ones?

Reference Issues/PRs

Fixes #1330.

What does this implement/fix? Briefly explain your changes.

Remove the owned Tokio runtime and synchronous search interface from DiskIndexSearcher.

  • Runtime ownership: Construction no longer accepts or creates a runtime. Both search and search_with_indexed_vectors are asynchronous, and all search modes await the underlying operations directly. Synchronous benchmark execution manages its runtime at the caller.
  • Internal structure: Consolidate search dispatch into one private helper. Builder ground-truth checks and search behavior tests exercise the public interface; filtered-search tests no longer repeat the same assertions through the internal helper.

Search modes, result layouts, filtering, and parameter validation remain unchanged.

Any other comments?

None.

Make disk search asynchronous, move runtime ownership to callers, and exercise the public search API in builder and search tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@wuw92
Wei Wu (wuw92) requested review from a team and a lite review from Copilot September 9, 2026 07:49

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.

🟡 Changes recommended

The new current-thread runtime usage is shared across Rayon threads in tests/benchmarks, which can serialize execution and skew multi-thread behavior and benchmark results.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR removes DiskIndexSearcher’s owned Tokio runtime and synchronous search wrappers, standardizing disk-index search on an async API so runtime/executor management is owned by callers (e.g., benchmarks/tests).

Changes:

  • Removed the Runtime field and runtime: Option<Runtime> constructor argument from DiskIndexSearcher.
  • Converted search and search_with_indexed_vectors to async fn, consolidating dispatch into a single async search_internal helper.
  • Updated builder verification, benchmarks, and tests to await the async API or to drive it using an externally managed runtime.
File summaries
File Description
diskann-disk/src/search/provider/disk_provider.rs Removes runtime ownership, makes search APIs async, and updates tests to use async calls / external runtimes.
diskann-disk/src/build/builder/core.rs Updates ground-truth verification to drive async search via an external runtime.
diskann-benchmark/src/disk_index/search.rs Updates benchmark execution to drive async search via a runtime managed by the benchmark code.
Review details

Suppressed comments (1)

diskann-disk/src/search/provider/disk_provider.rs:1992

  • Same concern as test_disk_search: a single current-thread runtime shared across Rayon workers can serialize block_on calls and undermine the multi-threaded associated-data search test. Prefer a multi-thread runtime (or one runtime per worker thread) when driving async work from multiple threads.
        let runtime = tokio::runtime::Builder::new_current_thread()
            .build()
            .unwrap();
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread diskann-benchmark/src/disk_index/search.rs
Comment thread diskann-disk/src/search/provider/disk_provider.rs
@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.27586% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.58%. Comparing base (8fb4d42) to head (c2d7b6d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
diskann-disk/src/search/provider/disk_provider.rs 98.64% 3 Missing ⚠️
diskann-disk/src/build/builder/core.rs 90.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1388      +/-   ##
==========================================
+ Coverage   92.55%   92.58%   +0.02%     
==========================================
  Files         522      522              
  Lines      100890   101155     +265     
==========================================
+ Hits        93377    93652     +275     
+ Misses       7513     7503      -10     
Flag Coverage Δ
miri 92.58% <98.27%> (+0.02%) ⬆️
unittests 92.52% <98.27%> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
diskann-disk/src/build/builder/core.rs 97.13% <90.00%> (-0.16%) ⬇️
diskann-disk/src/search/provider/disk_provider.rs 96.20% <98.64%> (+0.55%) ⬆️

... and 8 files with indirect coverage changes

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

Comment thread diskann-disk/src/search/provider/disk_provider.rs Outdated
Return impl SendFuture from both public search methods so Send is checked at the API boundary while retaining async internal helpers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

Remove the owned Tokio runtime and synchronous  DiskIndexSearcher  API

5 participants