Skip to content

perf(dataset): read manifests concurrently in Dataset::versions - #10966

Merged
Xuanwo merged 3 commits into
lance-format:mainfrom
jackylee-ch:perf/pr-S11-2-VERSIONS-CONCURRENT
Nov 13, 2026
Merged

Xuanwo merged 3 commits into
lance-format:mainfrom
jackylee-ch:perf/pr-S11-2-VERSIONS-CONCURRENT

Conversation

@jackylee-ch

@jackylee-ch jackylee-ch commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Dataset::versions read 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_parallelism requests in flight. The result is still sorted by version, and a failed read still fails the call.

Testing

test_versions_reads_manifests_concurrently writes 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 ascending 1..=12 sequence, that at least one manifest read was observed, and that the peak never exceeds min(12, io_parallelism()). Overlap is only required when the effective window permits it, so the probe still holds when LANCE_IO_THREADS lowers the window; with LANCE_IO_THREADS=1 it 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_THREADS limits both the added memory and the concurrent request count.

cargo fmt --all --check, cargo check --locked --profile ci --workspace --tests --benches, and cargo clippy --locked --profile ci --all --tests --benches -- -D warnings are clean. dataset::tests::dataset_versioning (195 tests) and dataset::tests::dataset_transactions::test_read_version_transaction_on_branch pass, as does the probe with LANCE_IO_THREADS=1.

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.

@claude claude Bot 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.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Gate recommendation: approve with a non-blocking risk.

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.

Comment thread rust/lance/src/dataset.rs
version.manifest_size = manifest_size;
Ok(version)
})
.try_buffer_unordered(self.object_store.io_parallelism())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 11, 2026
@lance-gatekeeper lance-gatekeeper Bot removed K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 13, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Gate recommendation: approve with a non-blocking risk.

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.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 13, 2026

@Xuanwo Xuanwo left a comment

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.

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.

@Xuanwo
Xuanwo merged commit 67c0f32 into lance-format:main Nov 13, 2026
41 of 43 checks passed
Xuanwo added a commit to MarigWeizhi/lance that referenced this pull request Nov 13, 2026
…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.
Xuanwo added a commit to MarigWeizhi/lance that referenced this pull request Nov 13, 2026
- 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.
Xuanwo added a commit that referenced this pull request Nov 13, 2026
## 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants