Repository navigation
perf(dataset): read manifests concurrently in Dataset::versions - #10966
Conversation
Dataset::versions read and decoded every manifest one at a time, so the time grew by one object store round trip per version. Read them with up to io_parallelism requests in flight, the bound the other blob and cleanup lookups use. The result is still sorted by version.
There was a problem hiding this comment.
Bounded overlap addresses the serial manifest-read bottleneck while preserving version ordering and error propagation. For histories with large manifests, reducing LANCE_IO_THREADS limits the added memory and request concurrency.
| version.manifest_size = manifest_size; | ||
| Ok(version) | ||
| }) | ||
| .try_buffer_unordered(self.object_store.io_parallelism()) |
There was a problem hiding this comment.
The cloud default allows 64 manifest reads here, and each large manifest runs its own chunk-read window while retaining chunks until decoding. For gigabyte-scale manifests (the workload behind merged #6477), overlapping reads can substantially increase peak buffering and concurrent GETs. Reducing LANCE_IO_THREADS limits the overlap for memory-constrained callers.
There was a problem hiding this comment.
Bounded overlap addresses the serial manifest-read bottleneck while preserving version ordering and error propagation. For histories with large manifests, reducing LANCE_IO_THREADS limits the added memory and request concurrency.
Xuanwo
left a comment
There was a problem hiding this comment.
Approving for delivery. Concurrency is bounded by the existing io_parallelism() window, so LANCE_IO_THREADS remains the single control; the added peak buffering on large manifests is accepted as a documented nonblocking risk rather than a change to this call's contract.
…ns-pagination Resolve Dataset::versions overlap with lance-format#10966: versions() now delegates to versions_with_options(0, None, false), which keeps the ordered buffered manifest reads that lance-format#10966 introduced.
- versions() stays versions_with_options(0, None, false): ascending, same versions, metadata and manifest sizes, branch scoped, detached excluded. - Document ordering, offset/limit/None/zero, selected-page reads and the exact early-listing limits in the Rust, Python and Java surfaces. - Cover listing consumption with the existing forwarding probe: a descending V2 page on a lexically ordered store stops after offset + limit manifest entries, so a 2-version page at offset 1 consumes 3 of 5 entries. V1 names and non-lexically-ordered stores still enumerate every location, and a zero limit lists nothing. - Preserve the lance-format#10966 concurrency test and its effective-window bounds. Verified by an eager-listing negative control that fails only on the consumption assertion (5 consumed instead of 3) with the page still correct, then restored the production source exactly.
## Summary Closes #11006 - Add `Dataset::versions_with_options(offset, limit, descending)` so callers can read one page of `Version` entries instead of every historical manifest. `Dataset::versions()` delegates to it and still returns the whole history in ascending order, with the same versions, metadata and manifest sizes, scoped to the current branch and excluding detached versions. - Only the manifests in the requested page are read, concurrently within the store's effective IO window. A descending page on a lexically ordered store with V2 manifest paths stops listing after `offset + limit` entries; ascending pages, V1 manifest paths, and stores without lexically ordered listings enumerate every location before selecting the page. `None` means no limit, `0` returns an empty page without listing or reading, and an out-of-range offset returns an empty page. - Expose the same options in Python via `LanceDataset.versions(*, offset=0, limit=None, descending=False)` and `LanceDataset.count_versions()`, and in Java via `Dataset.listVersions(long offset, Optional<Long> limit, boolean descending)`. ## Test Plan - Rust: `dataset_versioning` suite (203 tests) and `test_read_version_transaction_on_branch`; a new listing-consumption test (memory V2 descending page of 2 at offset 1 consumes 3 of 5 manifest entries, V1 and local stores consume all 5, zero limit lists nothing) plus the #10966 concurrency test in default and `LANCE_IO_THREADS=1` configurations. - Python: `test_versions_pagination` on `memory://` and local against the extension built from this tree; `uv run make lint`. - Java: `DatasetTest` (72 tests) against the JNI built from this tree; `./mvnw spotless:check` and `cargo clippy --tests --manifest-path ./lance-jni/Cargo.toml`. - Workspace `cargo clippy --workspace --all-targets --profile ci --locked -- -D warnings` and `cargo fmt --all --check`. --------- Co-authored-by: Xuanwo <[email protected]>
Dataset::versionsread and decoded every manifest one at a time over the listing, so listing a long history paid one object store round trip per version. Tag and branch listing already read 10 refs at a time.This reads them with up to
io_parallelismrequests in flight. The result is still sorted by version, and a failed read still fails the call.Testing
test_versions_reads_manifests_concurrentlywrites 12 versions to an in-memory store, then lists them through a store wrapper that holds each_versions/read for 20 ms and records the peak in flight. It checks that the ids come back as a complete ascending1..=12sequence, that at least one manifest read was observed, and that the peak never exceedsmin(12, io_parallelism()). Overlap is only required when the effective window permits it, so the probe still holds whenLANCE_IO_THREADSlowers the window; withLANCE_IO_THREADS=1it passes at a peak of one. Under the default window it fails before the change.The 20 ms hold is probe instrumentation that makes in-flight overlap observable; it is not a throughput measurement.
Reading manifests concurrently raises peak buffering in proportion to the in-flight window times the manifest size, since each large manifest runs its own chunk-read window and retains chunks until decoding. For histories with large manifests, lowering
LANCE_IO_THREADSlimits both the added memory and the concurrent request count.cargo fmt --all --check,cargo check --locked --profile ci --workspace --tests --benches, andcargo clippy --locked --profile ci --all --tests --benches -- -D warningsare clean.dataset::tests::dataset_versioning(195 tests) anddataset::tests::dataset_transactions::test_read_version_transaction_on_branchpass, as does the probe withLANCE_IO_THREADS=1.