Repository navigation
fix(txn): reject DML that cannot follow an earlier write in the same transaction - #312
Merged
Merged
Conversation
…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.
There was a problem hiding this comment.
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.
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.
Several DML statements on one Lance table in a transaction can lose a change or fail
COMMITpart-way with earlier statements already published: each statement builds its own Lance transaction on the last committed version, andCOMMITpublishes them one by one.This rejects these combinations when the second statement is planned, before anything is written:
UPDATE/MERGE/unfilteredDELETE, thenUPDATE/MERGE/DELETEon the same table (was a commit conflict after the first was published)INSERT, thenDELETE/UPDATE/MERGE(was:DELETEsilently did nothing)INSERTafter any write,DELETEafterDELETEof other rows, and other tables are unchanged. The full fix needs Lance staged transactions (lance#10722). Fulltest/sqlpasses.Refs #313.