Skip to content

perf(io): validate checkpoint-sized small parts in one GET - #10315

Merged
Xuanwo merged 1 commit into
mainfrom
xuanwo/checkpoint-size-admission
Oct 25, 2026
Merged

Xuanwo merged 1 commit into
mainfrom
xuanwo/checkpoint-size-admission

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Oct 24, 2026

Copy link
Copy Markdown
Member

Opening a checkpointed small DataFilePart currently performs a HEAD to verify its length before reading the same object with GET. Add ObjectStore::open_with_expected_size so objects within the existing small-file threshold validate the complete GET response and buffer its body before returning the reader.

The explicit entry point checks metadata size, the complete response range, and exact body length with bounded collection. Metadata/range mismatches fail before polling the body; body failures retain the existing download retry budget. Ordinary open_with_size callers retain their metadata-hint behavior. Larger files retain HEAD validation and range reads; this does not pin a mutable large object across subsequent reads. Part footer, schema, row-count and Blob validation, and writing the final target remain required.

The tradeoff is eager body collection and copying for the explicit small-part path, before scheduler admission. No new cache, threshold or retry budget is introduced.

Validation on this exact source tree: 19 object-reader and 25 DataFilePart regressions passed, including malformed metadata/ranges, short/long bodies, cancellation, ordinary-reader behavior and large-file fallback. The tree was tested with parent dependency baseline 46a7cfe1fba5efa1f90deea4c7b14d414b991409; it is identical to tested tree 793c8babec9058007e334ec6f7773321a903d113. Current main has advanced; its combined dependency/runtime state has not been validated by these results. This PR makes no end-to-end performance claim.

@Xuanwo
Xuanwo requested a review from BubbleCal October 24, 2026 23:47

@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 repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@github-actions github-actions Bot added A-encoding Encoding, IO, file reader/writer performance labels Oct 24, 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.

No merge-blocking issues found. The single-GET path preserves checkpoint validation while ordinary size-hint readers retain their semantics. Focused reader and DataFilePart regressions passed on this head (44 tests).

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 24, 2026
@Xuanwo
Xuanwo merged commit ba43b33 into main Oct 25, 2026
40 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/checkpoint-size-admission branch October 25, 2026 04:35
Xuanwo pushed a commit that referenced this pull request Oct 26, 2026
Concatenating many staged data-file parts serializes each part's
open/validation and then reads payloads one column at a time. For small
parts containing vector output and auxiliary columns, these dependent
object-store requests dominate concatenation.

This change opens up to `min(io_parallelism, 8)` parts concurrently
while preserving caller order and all existing validation, including
#10315's single-GET validation for small parts and HEAD validation for
larger parts. For modern files that fit within the existing read-batch
budget, it submits payload ranges across columns together, sorted by
physical offset, and restores their logical order before copying. Larger
files retain streaming reads. There are no file-format or public API
changes.

The metadata-hint work in #9169 addresses a different source of read
dependencies; this change does not require it.

### Performance

Current-head performance has not been remeasured after merging main,
including #10315's small-part single-GET validation. The earlier
measurements below apply only to the stated historical commits and are
not a performance claim for the merged head.

<details>
<summary>Historical benchmark before merging main</summary>

Measured `Dataset::concat_data_file_parts` only, from baseline
`c633e438c291dbf1781657a37ad489098438af21` to the earlier candidate
`276d0ff57c792ac633c910928efa8d3ed97d8d96`. Values are medians of three
paired rounds; lower latency is better.

| Scenario / metric | Baseline | Measured candidate (276d0ff) |
Historical benefit |
| --- | ---: | ---: | ---: |
| 140 parts / concat latency | 54.12 s | 32.37 s | 1.67x speedup |
| 640 parts / concat latency | 204.11 s | 40.72 s | 5.01x speedup |
| 20 large parts / concat latency | 12.15 s | 11.24 s | 1.08x speedup |

The same AWS m7i.8xlarge host (32 vCPUs, 128 GiB RAM), four-CPU process
affinity, and same-region S3 in us-east-1 were used for both builds,
with Rust 1.98.1 and the repository's `release-no-lto` profile for this
I/O-bound workload. Input was frozen output containing 1,000,000 rows, a
384-dimensional Float32 vector, and five auxiliary columns, written as
Lance 2.2. Twenty 50,000-row splits were subdivided into parts of at
most 8,192, 1,563, or 50,000 rows. These are controlled part layouts,
not a reconstruction of adaptive Function Engine output partitioning.

Each run used a fresh fixture and process, with alternating baseline/PR
order and rotating scenarios; no other builds ran during measurement.
Full Arrow equality across all rows and all six columns was checked
after concatenation, outside the timer. S3 cache state was not
controlled. Observed latency ranges were 48.99–54.30 s / 30.19–33.81 s
for 140 parts, 202.13–211.54 s / 40.62–56.00 s for 640 parts, and
12.00–12.28 s / 10.53–11.61 s for 20 parts (baseline / PR).

Network allowance counters increased in every 140-part and 20-part
observation window, so those results describe this host's network
budget. All six 640-part windows had zero allowance-exceeded increments.
Counter windows enclosed concatenation and excluded bulk result
validation; they were not exact phase boundaries. These results do not
measure end-to-end Function Engine refresh, upload, or checkpoint
performance.

Object-store read/HEAD calls fell from 840 to 420 for 140 parts and from
3,840 to 1,920 for 640 parts; the 20-part fallback remained at 200
calls. Output sizes and write-call counts were unchanged. Counts are at
the object-store layer, not retry-inclusive HTTP requests.

</details>

### Validation after merging main

Validated merge commit `25120495af468dad17496d881d087704e0ea45ed`,
including main `71a1b76581c340cd29fc6d837b36efead2afa23b`.

- 27 data-file-part tests, 22 concat tests, and 19 object-reader tests
passed on the combined tree.
- Both small-part and large-part concurrency tests also passed with
`LANCE_IO_THREADS=1`. The small-part case requires zero HEAD requests
and exactly one GET per part; both cases check bounded fanout and caller
order.
- Formatting and full workspace Clippy (`--all --tests --benches -- -D
warnings`) passed.
- The original full-value benchmark results above remain historical;
performance has not been remeasured for the merged head.

<details>
<summary>Validation commands (macOS ARM64, Rust 1.98.1)</summary>

```sh
cargo fmt --all -- --check
cargo test --locked -p lance --features tokio/test-util --lib dataset::tests::data_file_part
LANCE_IO_THREADS=1 cargo test --locked -p lance --features tokio/test-util --lib opens_parts_concurrently_with_bounded_fanout_and_caller_order
cargo test --locked -p lance-file --features lance-io/aws,lance-io/test-util,tokio/test-util --lib concat::tests
cargo test --locked -p lance-io --features test-util,tokio/test-util --lib object_reader::tests
cargo clippy --locked --all --tests --benches -- -D warnings
```

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-encoding Encoding, IO, file reader/writer K-approved Latest Gatekeeper recommendation permits acceptance. performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants