Skip to content

vector-store: minimal DiskANN integration#504

Open
Akvear wants to merge 6 commits into
scylladb:masterfrom
Akvear:diskann-index-factory-skeleton
Open

vector-store: minimal DiskANN integration#504
Akvear wants to merge 6 commits into
scylladb:masterfrom
Akvear:diskann-index-factory-skeleton

Conversation

@Akvear

@Akvear Akvear commented Jul 6, 2026

Copy link
Copy Markdown

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

Copilot AI left a comment

Copy link
Copy Markdown

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 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::diskann module with a minimal DiskannIndexFactory implementation 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.

Comment thread crates/vector-store/src/vs_index/mod.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs
Comment thread crates/vector-store/src/vs_index/diskann.rs
Comment thread crates/vector-store/Cargo.toml Outdated
Comment thread Cargo.toml Outdated
@Akvear
Akvear force-pushed the diskann-index-factory-skeleton branch 6 times, most recently from bf0f8f7 to ce0f617 Compare July 8, 2026 10:01
@Akvear
Akvear requested a review from Copilot July 8, 2026 10:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread Cargo.toml Outdated
Comment thread crates/vector-store/Cargo.toml Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
@Akvear
Akvear force-pushed the diskann-index-factory-skeleton branch from ce0f617 to a32c707 Compare July 9, 2026 08:30
@Akvear Akvear changed the title vector-store: minimal diskann index factory skeleton vector-store: minimal DiskANN integration Jul 9, 2026
@Akvear
Akvear force-pushed the diskann-index-factory-skeleton branch from a32c707 to 1864678 Compare July 9, 2026 08:50
@Akvear
Akvear requested a review from Copilot July 9, 2026 08:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.

Comment thread crates/vector-store/src/vs_index/mod.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/config_manager.rs Outdated
Comment thread crates/vector-store/src/config_manager.rs
@Akvear
Akvear force-pushed the diskann-index-factory-skeleton branch 4 times, most recently from 94028e5 to 5a7a7f2 Compare July 13, 2026 12:53
@Akvear
Akvear requested a review from Copilot July 13, 2026 13:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.

Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread README.md Outdated
Comment thread crates/vector-store/tests/integration/info.rs
@Akvear
Akvear force-pushed the diskann-index-factory-skeleton branch from 5a7a7f2 to 703ce8f Compare July 13, 2026 15:07
@Akvear
Akvear marked this pull request as ready for review July 13, 2026 15:11
@Akvear
Akvear force-pushed the diskann-index-factory-skeleton branch from 703ce8f to cb407ba Compare July 14, 2026 10:16
@QuerthDP

Copy link
Copy Markdown
Member

Please provide a changelog and rerequest review once you finish responding to the round of commits.

Comment thread Cargo.toml
@@ -0,0 +1,83 @@
/*
* Copyright 2026-present ScyllaDB
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A new licence is LicenseRef-ScyllaDB-Source-Available-1.1. Also in other places.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we update it treewide?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think yes. But of course in dedicated PR.

Comment thread crates/vector-store/src/vs_index/diskann.rs
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs
@Akvear
Akvear force-pushed the diskann-index-factory-skeleton branch 2 times, most recently from 7d669ef to 633f1d9 Compare July 16, 2026 09:13
@Akvear

Akvear commented Jul 16, 2026

Copy link
Copy Markdown
Author

Changes:

  • split up a big commit into 3 logically separate commits
  • deleted a commit with unnecessary StorageProvider implementation, instead used a DiskANN FileStorageProvider
  • squashed mapping tests into the previous commit
  • fixed commit history to not mislead about the quantization
  • kept one line per import style
  • put new imports and new constants in appropriate commits
  • changed commit order to make all of them compile

@Akvear
Akvear requested a review from QuerthDP July 16, 2026 09:21
@Akvear
Akvear force-pushed the diskann-index-factory-skeleton branch from 633f1d9 to 7a589de Compare July 16, 2026 11:14

@knowack1 knowack1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please find more comments from my side.

Given the scope, I'd suggest splitting this into two separate PRs:

  1. 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.
  2. Actual DiskANN index implementation — the collector, build pipeline, serving state, etc.

Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
dimensions: Dimensions,
vectors: &[(PrimaryId, Vector)],
) -> anyhow::Result<()> {
let dataset = File::create(dataset_path).map_err(|e| {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should use async I/O functions

Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
@Akvear

Akvear commented Jul 16, 2026

Copy link
Copy Markdown
Author

Changes:

  • Changed the scope of this PR

Comments regarding the part delegated to a follow up will be addressed in the follow up.

Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment on lines +113 to +115
fn try_from(
(cfg, alpha, max_points): (&VsIndexConfiguration, f32, usize),
) -> Result<Self, Self::Error> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could it be better to have DiskannParams::new() -> anyhow::Result<_>?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/lib.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
@Akvear
Akvear force-pushed the diskann-index-factory-skeleton branch 2 times, most recently from 70987c3 to 5a09dc4 Compare July 16, 2026 14:03
@Akvear

Akvear commented Jul 16, 2026

Copy link
Copy Markdown
Author

Changes:

  • removed quantization from the scope
  • fixed newlines between imports
  • changed usize and f32 to more restricitve types
  • changed std::fs to tokio::fs
  • updated env variable name in README

Comment thread crates/vector-store/src/config_manager.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
debug!("starting");

async {
if tokio::fs::try_exists(&index_dir).await.unwrap_or(false) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Comment thread crates/vector-store/src/config_manager.rs Outdated
Comment thread crates/vector-store/src/config_manager.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
.unwrap();

assert_eq!(
params.config.pruned_degree(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is a pruned_degree() and how does it apply to the MAX_POINTS?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread README.md
Comment thread crates/vector-store/tests/integration/info.rs
Comment thread crates/vector-store/src/lib.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
Comment thread crates/vector-store/src/vs_index/diskann.rs Outdated
@Akvear
Akvear force-pushed the diskann-index-factory-skeleton branch from 520004a to f7342ee Compare July 17, 2026 10:58
Akvear added 6 commits July 17, 2026 13:01
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
@Akvear
Akvear force-pushed the diskann-index-factory-skeleton branch from f7342ee to c94cb77 Compare July 17, 2026 11:01
@Akvear

Akvear commented Jul 17, 2026

Copy link
Copy Markdown
Author

Changes:

  • removed parameters mapping from the scope as they are not needed yet
  • fixed commit history to read better
  • removed unused crates
  • added directory wipe both in new_diskann and on index creation
  • added unit tests for dir wipe

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.

Comment on lines +74 to +94
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))?;
}
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Is it better/allowed to remove the directory entirely and recreate it?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We could assume that the parent directory provided by env variable exists and the content we can remove/create how we want.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

What about when the directory we want to wipe is the diskann root path from the env var?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ok, that's the way it is now.

@Akvear
Akvear requested review from QuerthDP and knowack1 July 17, 2026 11:11
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.

5 participants