Repository navigation
feat: expose a public toggle for disable_transaction_file - #11232
Conversation
|
I pushed a fix for the review (d9fbb36). Could a maintainer add the |
## Summary Use the existing `lance_table::format::Transaction::try_from(&Transaction)` conversion in the two places that rebuilt the format wrapper by hand: - detached commit collision retry, when rebuilding the inline transaction copy - injected foreign-commit test helper Also correct the `format::Transaction` docs. The wrapper holds a `pb::Transaction` message in memory; the manifest writer serializes it at `write_protobuf`. Because `inner` and `From<pb::Transaction>` are public, wrapping does not imply validation. The reverse `From` only moves the message out without another conversion. ## Behavior and compatibility - `lance_table::format::Transaction`, `inner`, `as_pb`, `CommitHandler`, and `ManifestWriter` are unchanged. - No durable-format change; inline/spill decisions and schema classification remain in their existing paths. - Commit outcome verification still compares durable protobuf messages, preserving the rewrite frag-reuse case. - The detached retry still only rebuilds the inline copy; the external `.txn` file is still written once before the retry loop. - The injected foreign-commit test still exercises the same retry path through the shared conversion. ## Validation - `cargo fmt --all -- --check` - `cargo clippy --all --tests --benches --profile ci -j 8 -- -D warnings` - `cargo test -p lance-table --lib --profile ci format::transaction`: 4 passed - One `cargo test -p lance --lib --profile ci -j 1 --no-run` link; 18 targeted runtime tests passed from the same binary: - 8 commit outcome and transaction-file tests - 3 injected foreign-commit/raw-arrow retry tests (one rstest case pair) - 7 dataset transaction inline/external/detached tests There is no deterministic test for the detached random-version collision retry itself; that branch is compile-covered, and the same conversion is exercised by the injected foreign-commit tests. The detached first-attempt path is covered by `test_list_detached_manifests`. No diff overlap with #11232 (inline toggle), #11021 (expected-head mode), or #11280 (test metadata); none changes these conversion sites.
|
Hi @Xuanwo, when you have a moment, could you take a look at this one or point me to the right reviewer? It exposes |
Xuanwo
left a comment
There was a problem hiding this comment.
Thanks @vaibhavdabas16. I added breaking-change and authorized the fork CI.
Merge blocker. With the external file disabled, the inline section is the only transaction record. Its writer casts the encoded byte length to u32. Please reject a length above u32::MAX before publishing the manifest and test the boundary without allocating 4 GiB. This finding comes from code inspection.
Please also document the v14 minimum for clients that need transaction history or rebase across an inline-only commit. On a fixture constructed from real append bytes in this layout, v14.0.3 read the Append. v9.1.0-beta.2 scanned both rows but returned no transaction and failed to rebase. The v13.0.0 schema and reader source confirm the same limitation. Mixed deployments with older transaction consumers should keep the external file.
When rebasing onto the current commit runtime, please retain #11411’s keyed-append guard. The rebase also picks up #11370’s url update for cargo-deny.
Add WriteParams::disable_transaction_file and CommitBuilder::with_disable_transaction_file, so a commit can store its transaction only inline in the manifest and skip the separate file under _transactions/. The setting applies per commit: later commits that leave it unset write the transaction file again and drop the writer feature flag. Python's write_dataset gains the same option. With the file disabled, the inline copy is the only durable one, so it is kept regardless of size on the new-dataset, regular and detached commit paths. A transaction too large for the inline section's u32 length prefix is rejected before anything is published. An empty transaction file path is recorded as None in the in-memory manifest, matching what is read back from storage. Readers older than Lance 14.0 return no transaction for such a version and cannot rebase across it; the docs say so. Closes lance-format#7486
d9fbb36 to
e8d9c10
Compare
|
Thanks @Xuanwo, and thanks for the label and CI approval. I've rebased onto main and ported the change onto the commit runtime as one commit, e8d9c10.
Checks run locally:
|
Xuanwo
left a comment
There was a problem hiding this comment.
Thanks for the rebase. In e8d9c10d, create, detached commit, and each regular commit attempt check the encoded transaction length before publication. The Rust and Python docs now explain the v14 minimum for transaction history and rebase, and the keyed-append guard is intact.
One merge blocker remains in CommitHooks::inlines_transaction. It returns Ok(true) for a length within inline_transaction_limit() before checking whether the section’s u32 prefix can represent that length. The built-in 20 MiB threshold is safe, but a CommitLifecycleHook can supply a larger usize threshold. With the sidecar disabled, the unrepresentable inline section would be the only transaction record.
Please check the section maximum first. Above it, use the sidecar when enabled and return InvalidInput when disabled. A length-only test with a hook threshold above the section maximum would cover both outcomes.
inlines_transaction accepted any length within inline_transaction_limit() before checking that the inline section's u32 length prefix can encode it. A CommitLifecycleHook may supply a larger limit, so with the transaction file disabled an unrepresentable inline section could have been the only transaction record. Check the section maximum first: above it, use the transaction file when enabled and reject the commit when disabled.
|
Thanks @Xuanwo, fixed in 00e7334. The decision is now
|
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The reported fix now checks the inline section’s u32 maximum before the lifecycle hook’s configurable limit. Oversized transactions use the external file when enabled and fail before publication when it is disabled, preserving a durable transaction across commit paths.
Keep the external file when transaction-history readers or concurrent writers run Lance older than 14.0. Larger manifests remain the documented opt-in cost, and keyed append still requires an external transaction file.
Xuanwo
left a comment
There was a problem hiding this comment.
Thanks for fixing the hook limit in 00e733431. This resolves my section-length blocker. With the hook limit set to usize::MAX, u32::MAX still fits inline. One byte more goes to the external transaction file when enabled and returns InvalidInput when disabled. All nine length-only cases and the default hook test passed in Linux x86 CI.
Closes #7486
Summary
disable_transaction_filewas plumbed end to end but could only be turned on from tests. This adds a public switch:WriteParams::disable_transaction_file(Rust), forwarded byInsertBuilder.CommitBuilder::with_disable_transaction_file(bool), in bothlanceandlance-table-runtime.disable_transaction_file=onlance.write_dataset(Python), as a thin wrapper overWriteParams.When it's set, the commit stores its transaction only in the manifest's inline
transaction_section, skips the_transactions/file, and setsFLAG_DISABLE_TRANSACTION_FILE.The setting is per commit, because the flag is not inherited: a later commit that leaves it unset writes the file again and drops the flag. The default stays
false; turning it on by default is #7487.Durability: with the file disabled, the inline copy is the only record of the transaction.
CommitHooks::inlines_transactionkeeps the transaction inline regardless ofMAX_INLINE_TRANSACTION_BYTESon the new-dataset, regular/rebased and detached commit paths.u32length prefix is rejected withInvalidInputbefore anything is published.Nonein the in-memory manifest, matching what is read back from storage.Compatibility:
This is a breaking change for Rust callers that build
WriteParamswith an exhaustive struct literal. Java bindings aren't included and can follow in a separate PR with the same parameter name.Tests
test_disable_transaction_file_applies_to_its_commit_only: no transaction file is written, the flag is set, a freshly opened dataset reads the inline transaction, and a following append writes the file and clears the flag.test_large_transaction_inlined_when_transaction_file_disabled: create, append and a detached commit with a transaction above the spill threshold stay inline and read back.test_inlines_transactioninlance-table-runtime: the inline decision, including theu32::MAXboundary, using lengths only.test_disable_transaction_filecovers the same behavior throughwrite_dataset.Local verification
cargo test -p lance-table-runtime --lib -- inlines_transaction retry: 17 passed.cargo test -p lance --lib -- transaction: 166 passed.cargo test -p lance-table --lib: 1698 passed.cargo fmt, ruff, ruff-format and typos pass.