Skip to content

fix(txn): reject DML that cannot follow an earlier write in the same transaction - #312

Merged
Xuanwo merged 1 commit into
lance-format:mainfrom
jackylee-ch:fix/txn-multi-dml-guard
Nov 12, 2026
Merged

Xuanwo merged 1 commit into
lance-format:mainfrom
jackylee-ch:fix/txn-multi-dml-guard

Conversation

@jackylee-ch

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

Copy link
Copy Markdown
Contributor

Several DML statements on one Lance table in a transaction can lose a change or fail COMMIT part-way with earlier statements already published: each statement builds its own Lance transaction on the last committed version, and COMMIT publishes them one by one.

This rejects these combinations when the second statement is planned, before anything is written:

  • UPDATE/MERGE/unfiltered DELETE, then UPDATE/MERGE/DELETE on the same table (was a commit conflict after the first was published)
  • INSERT, then DELETE/UPDATE/MERGE (was: DELETE silently did nothing)

INSERT after any write, DELETE after DELETE of other rows, and other tables are unchanged. The full fix needs Lance staged transactions (lance#10722). Full test/sql passes.

Refs #313.

…transaction

Every DML statement on a Lance table builds its own Lance transaction against
the last committed version, and COMMIT publishes them one by one. Some
combinations therefore lose a change or fail part-way through COMMIT with the
earlier statements already published:

- INSERT then DELETE/UPDATE/MERGE: the second statement cannot see the inserted
  rows, so a DELETE of them silently does nothing.
- UPDATE/MERGE/unfiltered DELETE followed by another UPDATE/MERGE/DELETE on the
  same table: Lance rejects the second commit as a conflict after the first
  one is published.

Reject these statements when they are planned, before anything is written. INSERT
after any write, DELETE after DELETE of other rows, and writes to different
tables keep working. A proper fix needs staged transactions in Lance; this is
the fail-closed step until then.

@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

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.

The guard is a reasonable interim fix: incompatible writes are rejected before COMMIT, while append and disjoint-delete workflows remain supported. Local SQL and prepared-execution/rollback checks passed.

Transactions still lack read-your-writes and can partially publish when a later permitted commit conflicts, including overlapping DELETEs. These pre-existing limits remain documented and tracked in #313; full support needs Lance staged transactions, which currently cover appends only.

@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 12, 2026
@Xuanwo
Xuanwo merged commit c124e08 into lance-format:main Nov 12, 2026
7 checks passed
@jackylee-ch
jackylee-ch deleted the fix/txn-multi-dml-guard branch November 13, 2026 08:25
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants