vector-store: minimal DiskANN integration#504
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial (non-wired) DiskANN index-engine skeleton into the vector-store crate and adds the DiskANN dependency set to the workspace, as a first step toward future DiskANN integration.
Changes:
- Adds a new
vs_index::diskannmodule with a minimalDiskannIndexFactoryimplementation and a stub actor loop. - Registers the new module in
vs_index/mod.rs(currently suppressed as unused). - Adds DiskANN-related crates (
diskann,diskann-providers,diskann-quantization,diskann-vector) to workspace and vector-store dependencies.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/vector-store/src/vs_index/mod.rs | Exposes the new DiskANN module (currently marked as unused). |
| crates/vector-store/src/vs_index/diskann.rs | Adds a stub DiskannIndexFactory + actor loop with placeholder behavior. |
| crates/vector-store/Cargo.toml | Adds DiskANN crates as dependencies of the vector-store crate. |
| Cargo.toml | Adds DiskANN crates to workspace dependencies (currently pinned exactly). |
| Cargo.lock | Captures the resolved dependency graph updates for the new crates. |
bf0f8f7 to
ce0f617
Compare
ce0f617 to
a32c707
Compare
a32c707 to
1864678
Compare
94028e5 to
5a7a7f2
Compare
5a7a7f2 to
703ce8f
Compare
703ce8f to
cb407ba
Compare
|
Please provide a changelog and rerequest review once you finish responding to the round of commits. |
| @@ -0,0 +1,83 @@ | |||
| /* | |||
| * Copyright 2026-present ScyllaDB | |||
| * SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0 | |||
There was a problem hiding this comment.
A new licence is LicenseRef-ScyllaDB-Source-Available-1.1. Also in other places.
There was a problem hiding this comment.
I think yes. But of course in dedicated PR.
7d669ef to
633f1d9
Compare
|
Changes:
|
633f1d9 to
7a589de
Compare
knowack1
left a comment
There was a problem hiding this comment.
Please find more comments from my side.
Given the scope, I'd suggest splitting this into two separate PRs:
- Scaffolding for the DiskANN index instance — everything needed to create the index where all methods return "not implemented" (or similar stub). This can be verified via the info.version integration test already included in this PR.
- Actual DiskANN index implementation — the collector, build pipeline, serving state, etc.
| dimensions: Dimensions, | ||
| vectors: &[(PrimaryId, Vector)], | ||
| ) -> anyhow::Result<()> { | ||
| let dataset = File::create(dataset_path).map_err(|e| { |
There was a problem hiding this comment.
I'm not sure whether we should use the blocking or async versions of the I/O functions. Using the blocking versions might make sense here for performance reasons. @ewienik , could you please advise?
There was a problem hiding this comment.
We should use async I/O functions
|
Changes:
Comments regarding the part delegated to a follow up will be addressed in the follow up. |
| fn try_from( | ||
| (cfg, alpha, max_points): (&VsIndexConfiguration, f32, usize), | ||
| ) -> Result<Self, Self::Error> { |
There was a problem hiding this comment.
Could it be better to have DiskannParams::new() -> anyhow::Result<_>?
There was a problem hiding this comment.
I see there is still TryFrom implemented for a tuple of three types - IMHO it is a sign that there is a need for a ctor method instead of TryFrom.
70987c3 to
5a09dc4
Compare
|
Changes:
|
5a09dc4 to
520004a
Compare
| debug!("starting"); | ||
|
|
||
| async { | ||
| if tokio::fs::try_exists(&index_dir).await.unwrap_or(false) { |
There was a problem hiding this comment.
I think we need to wipe the existing index data at bootup - as they can be out of sync. However, this can't be done at the individual index level because we also need to wipe data for indices that no longer exist.
| .unwrap(); | ||
|
|
||
| assert_eq!( | ||
| params.config.pruned_degree(), |
There was a problem hiding this comment.
What is a pruned_degree() and how does it apply to the MAX_POINTS?
There was a problem hiding this comment.
Pruned degree is the R in VECTOR-717, it has nothing to do with MAX_POINTS. MAX_POINTS is a limit of how big the dataset the index is built around is, so it can preallocate resources - i am not sure where to get this value from.
520004a to
f7342ee
Compare
using a git commit sha because the required version function is not in the latest released crate
VECTOR_STORE_DISKANN_ROOT_PATH - path to root DiskANN indexes directory VECTOR_STORE_DISKANN_ALPHA - DiskANN parameter for index quality/build time tradeoff add unit test verifying diskANN config variables correctness verify info_diskann returns correct information
f7342ee to
c94cb77
Compare
|
Changes:
I am not sure whether it's needed to have all functions be async in the last commit, or if tokio has API that allows for something different. |
| let mut dir = fs::read_dir(root) | ||
| .await | ||
| .context("failed to read DiskANN root directory")?; | ||
|
|
||
| while let Some(entry) = dir | ||
| .next_entry() | ||
| .await | ||
| .context("failed to read directory entry in DiskANN root")? | ||
| { | ||
| let path = entry.path(); | ||
|
|
||
| if path.is_dir() { | ||
| fs::remove_dir_all(&path) | ||
| .await | ||
| .context(format!("failed to remove DiskANN directory: {:?}", path))?; | ||
| } else { | ||
| fs::remove_file(&path) | ||
| .await | ||
| .context(format!("failed to remove DiskANN file: {:?}", path))?; | ||
| } | ||
| } |
There was a problem hiding this comment.
Is it better/allowed to remove the directory entirely and recreate it?
There was a problem hiding this comment.
We could assume that the parent directory provided by env variable exists and the content we can remove/create how we want.
There was a problem hiding this comment.
What about when the directory we want to wipe is the diskann root path from the env var?
There was a problem hiding this comment.
IMHO we shouldn't remove directory provided by the env - it is our parent. We can modify all its content, but not directory itself. I think we shouldn't create this directory also - it should be created for vector-store before.
This PR are the first steps towards integrating DiskANN.
There is 1 new imported crate:
diskann.Implemented end-to-end getter for version of diskann reported via GET.
The USearch and OpenSearch code paths behave unchanged.
Fixes: VECTOR-713
Fixes: VECTOR-716
Fixes: VECTOR-718
Fixes: VECTOR-712