Repository navigation
perf(file): reduce metadata read scheduling rounds - #9169
Closed
Ali2Arslan wants to merge 6 commits into
Closed
Ali2Arslan wants to merge 6 commits into
Ali2Arslan wants to merge 6 commits into
Conversation
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Xuanwo
added a commit
that referenced
this pull request
Oct 23, 2026
## Proposal Add one advisory `file_metadata_size_bytes` value to `DataFile` and `IndexFile`. For a Lance file of format version 2.0 or later, it is the file size minus the position of global buffer 0, which holds the file's `FileDescriptor`. That position is stored in the first entry of the global buffer offset table, which the footer locates. The value is always zero for legacy (0.1) files and for index files in other formats; zero also means unknown. Writers record either this exact value or zero. Footer offsets and counts remain authoritative. Readers ignore a value larger than the file and read any metadata the footer references outside the hinted range. ## Rationale A full metadata open always needs this complete suffix. Recording its exact size lets a reader schedule the required bytes immediately instead of waiting for a footer read before scheduling the metadata prefix. This optimizes dependency depth independently of physical request count; the scheduler may still split a large logical range into concurrent requests. Projected data-file opens do not need another persisted value: an implementation can estimate the CMO table from the manifest's existing physical-column mappings and retain a prefix-only fallback. ## Compatibility - Existing readers ignore the new protobuf fields. - Existing writers encode zero by omission. - New readers retain the ordinary footer-directed path when the value is unusable. - The Lance file bytes and footer grammar do not change. - No feature flag or file-format version bump is required because the value is advisory. - The in-memory representation uses `Option<NonZeroU64>`, so the hint occupies one `u64` slot. - `DataFile` JSON always includes `file_metadata_size_bytes` (`null` when unknown), like `file_size_bytes` and `base_id`. Python's `DataFile` accepts and carries the value because `FragmentMetadata.from_json` builds it from that JSON, for example for write progress and distributed compaction. - Java conversions and the Python `IndexFile` conversion initialize the new fields as unavailable until the follow-up implementation propagates them. Per the format-change process, this PR contains only the durable contract, documentation, and minimum compilation/round-trip updates. The reader/writer implementation is prepared in #9169 and remains draft until this change merges. ## Maintainer action Gatekeeper requested the `breaking-change` label. GitHub does not permit fork contributors to apply repository labels, so a maintainer must add it. ## Validation - `cargo test -p lance-table --lib -- test_to_json test_intern_fragment_file_metadata_size_bytes test_rewritten_index_roundtrips test_roundtrip_fragment test_index_metadata_codec_roundtrip` - `uv run pytest python/tests/test_fragment.py python/tests/test_optimize.py python/tests/test_dataset.py::test_dataset_progress` - `cargo clippy --all --tests --benches -- -D warnings` - `uv run make lint` (from `python/`) - `python3 ci/check_proto_comments.py protos/table.proto protos/fragment_metadata.proto` Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <[email protected]> Co-authored-by: Xuanwo <[email protected]>
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>
Contributor
Author
|
Closing this stale draft. It conflicts with main and I'm not pursuing it now. |
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.
Status
Draft and stacked on #9168. After the format contract merges, rebase away its duplicated contract changes and mark this PR ready.
What this does
baseline_tail + 16 * estimated_physical_columns.max_iop_size; admitted logical ranges may still split concurrently. A zero/unbounded byte-backpressure setting conservatively uses the baseline footer path.FileSchedulersplitting into concurrent physical requests; dependency depth and physical request count remain separate concerns.I/O behavior covered by tests
FileSchedulerrequest splitting remains unconstrained by the hint planner.Validation
cargo test -p lance-filecargo test -p lance-index metadata_hint_removes_scalar_index_footer_dependencycargo test -p lance concatenates_parts_in_caller_order_without_reusing_staging_filescargo test -p lance test_hnsw_index_records_file_sizescargo test -p lance test_legacy_non_divisible_pq_searchuv run pytest python/tests/test_fragment.py::test_fragment_meta python/tests/test_commit_index.py::test_commit_index_with_files python/tests/test_table_ops.py::test_data_file_create_basic python/tests/test_table_ops.py::test_data_file_create_end_to_enduv run make lintcargo clippy --tests --manifest-path java/lance-jni/Cargo.toml -- -D warnings./mvnw -Dtest=FragmentTest,TransactionTest testcargo clippy --all --tests --benches -- -D warningsMade with Cursor