Repository navigation
feat: support prewarm for IVF-based ANN indices - #6090
Conversation
PR Review: feat: support prewarm for IVF-based ANN indicesP1: Hardcoded concurrency in v2 IVFIndexIn futures::stream::iter(0..self.ivf.num_partitions())
.map(Ok)
.try_for_each_concurrent(Some(8), |part_id| { ... })The legacy Suggestion: either store the Tests look solid — they verify the full lifecycle (prewarm causes IO, subsequent queries don't, second prewarm is a no-op). Everything else looks good. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Calling prewarm on IVF indices will now load the sub index partitions into the cache. Related to lance-format#3698
…m test (#11629) Closes #6745. ## Summary Most of #6745 had already been done by earlier PRs. This PR adds no new codec or serialization logic. It only extends test coverage to the two IVF+HNSW variants that weren't tested yet. The issue asked for two things. Both were already on `main`: 1. **Zero-copy Arrow IPC serde for HNSW cache entries.** HNSW partitions go through the generic IVF `PartitionEntry<S, Q>` codecs in `rust/lance/src/index/vector/ivf/partition_serde.rs`. Those write the sub-index with `write_ipc(index.to_batch())` and read it back through `HNSW::load`. Since #6798, `HNSW::load` keeps the Arrow batch and serves neighbor lists zero-copy (`LoadedHnswGraph`). `to_batch()` hands that batch back unchanged, so a loaded graph round-trips through the cache without being rebuilt. 2. **A test showing that, after prewarm, a serializing backend serves HNSW queries with no IO.** `test_prewarm_and_query_with_serializing_backend` prewarms through `SerializingCacheBackend`, restarts the backend so only serialized entries survive, queries, checks recall, and asserts `read_iops == 0`. It already covered IVF_HNSW_SQ and IVF_HNSW_RQ. Earlier PRs that did the work: - #6090: prewarm for IVF indices and the no-IO assertion - #6223: `CacheCodec` and the IVF partition codecs, which are generic over the sub-index - #6798: zero-copy HNSW loading - #8136: the IVF_HNSW_SQ case - #10522: the IVF_HNSW_RQ case ## Changes Adds `ivf_hnsw_pq` (`PartitionEntry<HNSW, ProductQuantizer>`) and `ivf_hnsw_flat` (`PartitionEntry<HNSW, FlatQuantizer>`) cases to `test_prewarm_and_query_with_serializing_backend`. Every IVF+HNSW variant is now covered by the prewarm, restart and no-IO check. ## Testing - `cargo test --profile ci -p lance --lib test_prewarm_and_query_with_serializing_backend`: all 5 cases pass (`ivf_pq`, `ivf_hnsw_sq`, `ivf_hnsw_rq`, and the new `ivf_hnsw_pq` and `ivf_hnsw_flat`) in 1.55s. - `cargo fmt --all -- --check`: clean. - `cargo clippy --profile ci -p lance --tests --benches -- -D warnings`: clean. Clippy was run on the touched crate only, not with `--all`. --- _Generated by [Claude Code](https://claude.ai/code)_ Co-authored-by: Claude <[email protected]>
Calling prewarm on IVF indices will now load the sub index partitions into the cache.
Related to #3698