Repository navigation
fix: bound raw vector reads when splitting IVF partitions - #9574
Merged
Merged
Conversation
Xuanwo
marked this pull request as ready for review
September 26, 2026 06:49
BubbleCal
approved these changes
Sep 28, 2026
Xuanwo
added a commit
to lancedb/lancedb
that referenced
this pull request
Sep 29, 2026
Updates the Rust workspace dependencies, Cargo lockfile, and Java `lance-core` to [Lance v13.0.0-beta.18](https://github.com/lance-format/lance/releases/tag/v13.0.0-beta.18). It includes lance-format/lance#9574, which bounds the memory an IVF partition split uses when it re-reads raw vectors during `optimize_indices`, and lance-format/lance#9582, which keeps the mTLS REST namespace client on rustls. Lance's new combined-fields FTS query variant (introduced by v13.0.0-beta.17) is handled the same way as in #4336: the remote capability check and Rust/Node bindings accept it, with a regression test for the remote request payload, and the Python conversion reports that this query type is not yet supported. This PR supersedes #4336.
LuciferYang
added a commit
to LuciferYang/lance
that referenced
this pull request
Oct 2, 2026
…eam merge The upstream merge of lance-format#9574 moved reshuffle_partitions onto the spawn_cpu CPU-worker pipeline, which resumes a task panic in place and yields Result<RecordBatch, Error> directly, so there is no JoinError to remap. The carried-over .map left the stream item type wrong and broke the build. The shuffle_data path keeps its own mapping, which still applies there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
optimize_indicessplits IVF partitions,reshuffle_partitionsre-reads the raw vectors of every affected partition. It chunked row ids byObjectStore::block_size(), a byte count (64 KiB on cloud stores), as a row count, and keptio_parallelism()chunks in flight (64 on cloud stores). A split that touches most of the index therefore held most of the table's raw vectors in memory at once. In production this showed up as an IVF_PQ append that was OOM-killed at a 12 GiB memory limit on every retry, since the retried job repeats the same split.The re-read now uses the fetch policy the join path already had: each fetch is sized to
RAW_VECTOR_FETCH_BYTES(32 MiB) with two fetches in flight, and multivector rows are fetched one at a time and regrouped by measured size. Each fetched batch is sliced across the transform workers instead of admitting one whole batch per worker, so the rows held at once depend on the fetch budget rather than on the number of affected rows or CPUs. The transform also moves fromtokio::spawn(...).unwrap()tospawn_cpu, so a panic surfaces as an error.The new resource test (
test_ivf_split_reshuffle_memory_stays_bounded, Linux only) re-reads 512 MiB of vectors through a split with a 64 KiB block size. It fails onmain(273 MB tracked peak) and passes here (42 MB) against a 128 MiB ceiling; it takes about 100 s in theciprofile.Benchmark
Default
optimize_indiceson 655,360 x 4096-dim f32 vectors (10 GiB) with an IVF_PQ index of 8 partitions and target partition size 8,192, after appending 4,096 rows. The optimize splits the 8 partitions into 83. Each run used a copy of the same dataset opened with a 64 KiB block size,LANCE_IO_THREADS=64, and a 2.73 CPU quota, on c8g.8xlarge (arm64), release build;main(15ca21f) and this branch (builder.rs as of 2c40324) alternated.Optimize time went from about 201 s to 183-194 s.