Skip to content

[4.2-dev] fix: stabilize DDL atomicity during logtail reconnect - #31571

Merged
XuPeng-SH merged 3 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:codex/issue-31542-42
Oct 28, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:codex/issue-31542-42

Conversation

@XuPeng-SH

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:

Fixes #31542

What this PR does / why we need it:

ddl_atomicity expects its ordered DDL statements to succeed, but it also injects random logtail receive failures. A reconnect can legitimately abort the active transaction: when it interrupts the internal mo_index_update DELETE in DROP DATABASE, the drop rolls back and subsequent assertions cascade.

Keep the existing DDL outcomes, remove the random fault from this success case, and clean up db1 at entry and exit. Replace the fault coverage with a deterministic real-SQL test that parks the DROP's catalog PK check, triggers a real logtail disconnect, and verifies the 20634 error, complete rollback and successful fresh retry for autocommit and explicit transactions. The test simulates the lock-conflict result; it verifies that the parked transaction belongs to the DROP session. Synchronize the existing test-only reconnect callback with its existing mutex and invoke it outside the lock. The admission fence and transaction retry policy are unchanged.

Validation on darwin/arm64, Go 1.26.4:

  • Exact ddl_atomicity mo-tester comparison twice on one SQL- and ISCP-ready two-CN cluster, using a round-robin TCP proxy: 96/96 statements passed each time, with db1 absent on both CNs after each run; connections reached both CNs.
  • Focused frontend, reconnect callback, original catalog DELETE rollback/retry, and existing callback consumer tests passed normally and under -race. The full disttae package passed normally and under -race; the callback race test passed 100 repetitions and the existing callback consumer passed two repetitions.
  • Incremental 47-package go vet, molint, and configured golangci-lint passed, with zero golangci-lint issues. Molint printed eight existing diagnostics in unchanged files while returning exit 0; none were on this delta. err-check, gofmt and diff checks passed.

The deterministic recovery test is single-CN and uses an injected lock-conflict result with a real disconnect; it does not claim a naturally occurring lock race. Linux CI remains separate.

@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 added the kind/test-ci label Oct 28, 2026
@XuPeng-SH

XuPeng-SH commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 603ee7b2efe0671f02d91fcc2522e90ba5adbc49

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 603ee7b2efe0671f02d91fcc2522e90ba5adbc49

Assessment: approve

Reviewed the complete six-file delta and discussion. The fixture split preserves existing DDL outcomes while adding explicit whole-transaction rollback/retry coverage. Callback synchronization preserves reentrant invocation outside the mutex. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Normal owning-package runs passed 1,985 top-level tests; one unrelated existing test was skipped.

  • Full disttae and isolated-test race suites passed 384 top-level tests. Four focused race tests also passed.

  • Adaptive race checks passed: callback registration 100 repetitions; SQL recovery and existing callback consumer two repetitions each.

  • Verified native build provenance, unchanged DDL statements and golden outcomes, formatting, clean source, and complete discussion coverage.

  • Receipts and logs reconciled in /home/xupeng/.local/state/mo-bot/jobs/d595ff9dc5b9fb405348aaea/attempt-1/validation-manifest.json. Initial executor-omission setup failures were excluded; corrected isolated runs passed.

Limitations:

  • Linux Compose BVT and the author's two-CN validation were not independently rerun; frozen substantive CI remained queued.

  • The recovery test uses one CN and a simulated lock-conflict result with real SQL and disconnect; it does not reproduce a natural multi-CN lock race.

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/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants