You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some write transactions only want to commit if some other fields, such as those read, have no changed concurrently. For example, if you are computing a column y based on a column x, you don't want to commit the new values for y if column x has concurrently changed, since that would place stale values.
Add a precondition onto the commit. Should pass field ids to choose columns, and RowAddressTreemap to specify which rows. There could potentially be multiple pre-conditions. Support for passing row ids (stable row ids) is left for a future change.
let rows_covered = RowAddressTreeMap::from(100..200);CommitBuilder::new(dataset).with_precondition(Precondition::cells_unchanged([3,4], rows_covered)).execute(transaction).await?
I'd like to pick this up. Two design points to align on before opening a PR:
1. The precondition must be a proto field on Transaction, not just a builder param. verify_commit_outcome detects a lost-response landing by comparing committed_transaction == *transaction byte-wise, and the read-back copy is deserialized from disk — anything not in the proto breaks that equality: a landed commit gets classified Foreign, the retry recomputes and republishes (the double-publish #9043 case 7 forbids). So Precondition { field_ids, serialized RowAddrTreeMap } goes into transaction.proto. Note this differs from #8801's CommitConfig::preconditions slot: that fits state re-derivable from the latest manifest; a declared read set only exists at staging time and must travel with the transaction.
2. Evaluation goes in the commit loop next to check_txn, against the pinned read_version state — not gated on check_txn.
A concurrent Delete on protected rows can be absorbed by rebase (deletion file merged, check_txn returns Ok) while the protected cells did change. Conflict compatibility and precondition validity are independent; conflict_resolver.rs stays untouched, so the #6898 differential-oracle constraint holds. This placement also gives #9043's "concurrent winner re-checks against the original dependencies" for free.
Error semantics: reuse PrerequisiteFailed for the report, propagate as RetryableCommitConflict so execute_with_retry auto-retries for a recomputing caller (it currently only retries RetryableCommitConflict). Reject precondition × strict_overwrite at build time (strict overwrite skips the check loop).
Plan: Phase 1 = this issue standalone (proto + builder + in-loop check + tests, no conflict_resolver.rs changes; can start on main since commit_after is merged). Phase 2 = #9043's field-disjoint Update × Update in finish. One question for that phase: is "conflict_resolver.rs must not be modified" a hard v1 freeze until #6898's actions cutover, or just a don't-fix-v1-on-the-v2-branch rule? That decides whether Phase 2 lands in v1 or waits for the v2 milestone.
Phase 1 is in progress in v1, following the two points above — the declared read set travels with the transaction, keeping it separate from #8801's re-derivable CommitPrecondition. Phase 2 (#9043) will land in v1 as well and port to V2 after the actions cutover.
Activity
lichuang commentedon Sep 9, 2026
I'd like to pick this up. Two design points to align on before opening a PR:
1. The precondition must be a proto field on
Transaction, not just a builder param.verify_commit_outcomedetects a lost-response landing by comparingcommitted_transaction == *transactionbyte-wise, and the read-back copy is deserialized from disk — anything not in the proto breaks that equality: a landed commit gets classifiedForeign, the retry recomputes and republishes (the double-publish #9043 case 7 forbids). SoPrecondition { field_ids, serialized RowAddrTreeMap }goes intotransaction.proto. Note this differs from #8801'sCommitConfig::preconditionsslot: that fits state re-derivable from the latest manifest; a declared read set only exists at staging time and must travel with the transaction.2. Evaluation goes in the commit loop next to
check_txn, against the pinned read_version state — not gated oncheck_txn.A concurrent
Deleteon protected rows can be absorbed by rebase (deletion file merged,check_txnreturnsOk) while the protected cells did change. Conflict compatibility and precondition validity are independent;conflict_resolver.rsstays untouched, so the #6898 differential-oracle constraint holds. This placement also gives #9043's "concurrent winner re-checks against the original dependencies" for free.Error semantics: reuse
PrerequisiteFailedfor the report, propagate asRetryableCommitConflictsoexecute_with_retryauto-retries for a recomputing caller (it currently only retriesRetryableCommitConflict). Rejectprecondition × strict_overwriteat build time (strict overwrite skips the check loop).Plan: Phase 1 = this issue standalone (proto + builder + in-loop check + tests, no
conflict_resolver.rschanges; can start on main sincecommit_afteris merged). Phase 2 = #9043's field-disjointUpdate × Updateinfinish. One question for that phase: is "conflict_resolver.rs must not be modified" a hard v1 freeze until #6898's actions cutover, or just a don't-fix-v1-on-the-v2-branch rule? That decides whether Phase 2 lands in v1 or waits for the v2 milestone.wjones127 commentedon Sep 9, 2026
I would not block on transaction V2 for this. We’ll need it more immediately. Can port this to V2 quickly once it is in v1.
lichuang commentedon Sep 9, 2026
Phase 1 is in progress in v1, following the two points above — the declared read set travels with the transaction, keeping it separate from #8801's re-derivable CommitPrecondition. Phase 2 (#9043) will land in v1 as well and port to V2 after the actions cutover.
feat(format): add cell preconditions to the transaction format
feat(format): add cell preconditions to the transaction format
feat(format): add cell preconditions to the transaction format
feat(format): add cell preconditions to the transaction format
feat(format): add cell preconditions to the transaction format
feat(format): add cell preconditions to the transaction format
feat(format): add cell preconditions to the transaction format
feat(format): add cell preconditions to the transaction format