Refactor disk index build structure - #1271
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ecf6179f-7467-44be-8a77-bf7a96e319af
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ecf6179f-7467-44be-8a77-bf7a96e319af
- Moved disk index builder tests to a new module structure for better organization. - Updated import paths in `disk_provider.rs` to reflect the new location of `IndexBuildFixture` and `TestParams`. - Enhanced the test suite for disk index building, including additional test cases and improved parameter handling.
There was a problem hiding this comment.
Pull request overview
This PR refactors the diskann-disk disk index build path to clarify module ownership: merged-index building logic is separated from top-level orchestration, and the in-memory single-graph build pipeline is consolidated behind an internal entry point, while keeping behavior unchanged.
Changes:
- Extract merged-index build implementation (partition/shard build/merge/cleanup) into a dedicated
merged_indexmodule. - Move the in-memory build pipeline into
inmem_builderand call it from the top-level disk builder. - Centralize builder test fixtures under
build::builder::testsand update test imports accordingly.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| diskann-disk/src/search/provider/disk_provider.rs | Updates test fixture import path to the new builder test module location. |
| diskann-disk/src/build/builder/tests.rs | Introduces centralized builder test fixtures and helpers under build::builder::tests. |
| diskann-disk/src/build/builder/quantizer.rs | Updates documentation wording for build quantizer types. |
| diskann-disk/src/build/builder/mod.rs | Adjusts module layout (adds merged_index, exposes tests as pub(crate) under cfg(test)). |
| diskann-disk/src/build/builder/merged_index.rs | New module containing merged-index build implementation and RAM estimation tests. |
| diskann-disk/src/build/builder/inmem_builder.rs | Consolidates the one-shot in-memory build pipeline behind an internal entry point. |
| diskann-disk/src/build/builder/build.rs | Keeps top-level orchestration and policy; wires in merged_index + inmem_builder entry points. |
| diskann-disk/src/build/builder/core.rs | Deletes the previous combined “core” module after refactor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ecf6179f-7467-44be-8a77-bf7a96e319af
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ecf6179f-7467-44be-8a77-bf7a96e319af
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ecf6179f-7467-44be-8a77-bf7a96e319af
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ecf6179f-7467-44be-8a77-bf7a96e319af
harsha-simhadri
left a comment
There was a problem hiding this comment.
could you please briefly list the tests in this PR and their intent in the PR description? thanks
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ecf6179f-7467-44be-8a77-bf7a96e319af
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1271 +/- ##
==========================================
- Coverage 91.06% 90.45% -0.62%
==========================================
Files 500 498 -2
Lines 95938 95138 -800
==========================================
- Hits 87369 86055 -1314
- Misses 8569 9083 +514
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
I’ve updated the PR description with a brief list of the covered build scenarios and the intent of each test. |
|
Before this change,
Making both modules private, together with reducing those items to If these APIs are intentionally being removed, could the PR description call out the breaking API change? Otherwise, should the old public paths be preserved or deprecated for a compatibility window? |
Thanks for calling this out. The visibility reduction is intentional. |
Why
This is a follow-up to #1254. Removing checkpoint and continuation support eliminated the workflow state that previously justified much of the disk-build indirection, allowing the remaining build path to be simplified and its module ownership clarified.
Module changes
core.rstomerged_index.rs; the renamed module retains the merged-build implementation and RAM estimation.tests.rs.IndexBuildStrategyanddetermine_build_strategyfrom the renamed module tobuild.rs, where the one-shot versus merged decision is made.build.rstoinmem_builder.rs.Compatibility
This change makes
builder::quantizerandbuilder::tokioprivate, including the previously publicBuildQuantizer,BuildQuantizer::train, andcreate_runtimeAPIs. These are implementation details ofdiskann-diskrather than supported downstream extension points. Downstream crates should use the public disk-index build APIs and manage their own Tokio runtime when needed.Tests
test_build_from_iter_one_shot_with_metricverifies one-shot builds for L2, inner-product, and cosine distance.test_build_multi_sector_per_nodeexercises the disk layout and search path when one node spans multiple 512-byte sectors.test_build_from_iter_one_shot_with_associated_dataverifies that vectors, neighbors, and associated data are persisted correctly without intermediate in-memory index files.test_build_from_iter_merged_indexforces the low-memory merged-build path and verifies search results and the configured maximum degree.test_build_quantization_type_failure_casesverifies that unsupported build quantization settings are rejected with the expected error.test_disk_index_buildercovers one-shot and merged builds with full precision, 1-bit scalar quantization, and product quantization, then validates persisted PQ data and search results.test_disk_minmax_index_buildercovers one-shot and merged builds for MinMax vector data and validates the resulting search behavior.