Skip to content

[4.2-dev] fix(txn): preserve snapshot state on cancellation - #26894

Merged
mergify[bot] merged 1 commit into
matrixorigin:4.2-devfrom
aptend:fix/txn-snapshot-context-26767-4.2
Aug 10, 2026
Merged

mergify[bot] merged 1 commit into
matrixorigin:4.2-devfrom
aptend:fix/txn-snapshot-context-26767-4.2

Conversation

@aptend

@aptend aptend commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #26767

What this PR does / why we need it:

Backport #26774 to 4.2-dev.

  • Publish a new transaction snapshot only after the timestamp waiter succeeds, so cancellation and waiter errors cannot replace a valid snapshot with 0-0.
  • Propagate the statement context through disttae workspace writes, table lookup, dump, compaction, and duplicate checking instead of detaching catalog lookup with a background context.
  • Return an ordinary invalid-input error when a transaction operation has no context deadline instead of terminating the CN process.
  • Reject canceled delete operations before workspace mutation and cover the cancellation paths with regression tests.

The existing statement rollback contract remains responsible for undoing workspace changes when cancellation arrives after a statement has already started mutating its workspace.

This is a clean cherry-pick of commit d68c9083e9411e55264bc54bc3b88fe1d079396a from #26774 onto 4.2-dev at 60283acdd464788cc0a1f91ad3e035dddc9454c4.

Validation:

  • go list, go build, and go vet for pkg/txn/client, pkg/vm/engine/disttae, pkg/sql/colexec/deletion, and pkg/sql/compile.
  • Full tests for those four packages.
  • Full race tests for pkg/txn/client and pkg/vm/engine/disttae.
  • Four focused cancellation/snapshot regressions under the race detector, each repeated 100 times.
  • git diff --check and pre-push concurrency/unhappy-path self-review.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-10 07:32 UTC · Rule: release-4.2 · triggered by rule Automatic queue on approval for release-4.2
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-08-10 07:33 UTC · at 1b0068a92f91bf6a3e205740db2c1bc41e7c0a6b · squash

This pull request spent 51 seconds in the queue, including 3 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants