Skip to content

Fix oversized TN WAL records before Log Service append - #31380

Merged
XuPeng-SH merged 12 commits into
matrixorigin:mainfrom
jiangxinmeng1:codex/fix-31350-wal-size
Oct 28, 2026
Merged

XuPeng-SH merged 12 commits into
matrixorigin:mainfrom
jiangxinmeng1:codex/fix-31350-wal-size

Conversation

@jiangxinmeng1

@jiangxinmeng1 jiangxinmeng1 commented Oct 27, 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:

Fixes #31350

What this PR does / why we need it:

A background merge can add transferred deletes after the existing approximate 70 MiB check. Its final WAL command can then exceed the Log Service receiver's 100 MiB message limit, retry for three minutes, and terminate TN.

Serialize the complete transaction command after PreApplyCommit, reject an oversized record before allocating a WAL LSN or driver DSN, and roll back that known pre-append rejection. Keep other WAL failures on the existing fail-stop path. Group commits now pack by encoded wire size and flush below the receiver budget. TN can set [LogService] max-wal-record-size to a budget at least 1 MiB below a customized Log Service rpc.max-message-size; the default is 99 MiB for the default 100 MiB receiver.

Validation: full tests in logservicedriver, wal, txnbase, txnimpl, tnservice, and db; focused race tests for size grouping and post-append rollback. Regression tests cover exact size boundaries, LSN/DSN continuity, rollback after apply, and a subsequent successful commit.

CI follow-up (2026-10-27): merged upstream/main at 1231f06468 and fixed the SCA prealloc finding in wal_size_test.go by allocating the DSN slice with the known record count. On [email protected], make -j2 cgo and TestCommitGroupsUseEncodedSize passed on the updated head. CI run 40459328082 passed SCA, x86 UT, both enabled multi-CN BVT jobs, changed-code coverage (33/41 blocks, 80.49%), and CI Required. The first SCA attempt lost its self-hosted runner; the failed job was rerun and passed in attempt 2.

Main advanced during CI. Merged the newer upstream/main at baa83f4b96 without conflicts; the WAL files were unaffected. CI run 40470840921 is validating this final merge.

Performance: final command serialization now runs before WAL enqueue, so the serialized bytes can be measured and reused instead of serialized in the group commit worker.

@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 →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

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: 2a9730daa863304e932653fe2386017ef60d7cf5

Assessment: request_changes

Reviewed the complete 25-file delta, linked issue and frozen discussion. Final-size admission belongs at the chosen WAL owners, but the new rejection path mishandles catalog rollback. The author's nonappendable-object fix is supported by passing controls; it does not resolve this separate, reproduced catalog defect.

Model: gpt-6-astra / xhigh

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

  • P1 pkg/vm/engine/tae/txn/txnbase/txnmgr.go:752: A transaction containing CREATE TABLE exceeds the final command-size or configured WAL-record limit after CollectCmd assigns CSNs.
    Impact: PrepareRollback removes the catalog MVCC node, but the nonzero CSN subsequently selects full ApplyRollback, which dereferences the removed node. The apply worker panics before DoneApply, leaving Commit blocked instead of returning the size error. Correct the late-rollback lifecycle so detached catalog nodes are not applied again while other cleanup completes; add catalog-operation and subsequent-commit regressions.
    Evidence: Current-head TestReviewOversizeCatalogCreate commits a normal CREATE control, then injects maxWalSize=1 for another CREATE. It logs a nil-pointer panic through mvccchain.go:164, table.go:2076 and store.go:786; Commit remains blocked until the 45-second timeout. Reproduction: /home/xupeng/.local/state/mo-bot/jobs/f301b2b92dfbbab326fe2fa0/attempt-1/overlay.json and wal_rollback_probe_test.go; output catalog-probe.log:170; exact command/source/exit receipt checks/1793099466446644989-4.json. The existing lifecycle warning at store.go:775-780 independently explains the failure.

Validation:

  • Artifacts retained under /home/xupeng/.local/state/mo-bot/jobs/f301b2b92dfbbab326fe2fa0/attempt-1. check-ledger.json correlates commands, source fingerprints, exits and log hashes.

  • Isolation preflight passed. Native prerequisites were built through the repository make owner from matching exported inputs; native-provenance.json records input and artifact hashes.

  • Ten focused tests across five packages passed, covering encoded sizing, LSN continuity, rollback, waiter completion and transfer-page cleanup: focused-controls.log and checks/1793099501828106009-4.json.

  • The independent catalog rejection probe failed with the reproduced product behavior; it was not a setup failure.

  • Final audit confirmed unchanged source, the frozen delta and complete unique coverage of all three discussion keys: discussion-assessment.json, review-audit.log and checks/1793100037411520608-4.json.

Limitations:

  • The reproduction uses an injected one-byte threshold through the real engine transaction path, not a 70 MiB SQL/TKE workload. DROP/ALTER variants were not runtime-tested.

  • Full-suite, race and TKE validation were not rerun. Reported remote merge results lack retained local receipts; the frozen exact-head CI snapshot does not establish substantive UT/BVT success.

  • Serialization scheduling, peak memory and transfer-lock costs were source-reviewed but not benchmarked; no performance-regression-free claim is made.

@XuPeng-SH

XuPeng-SH commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 1bb77341ff0165bdb9c9bdf0511634f158741dc5

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

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: 1bb77341ff0165bdb9c9bdf0511634f158741dc5

Assessment: approve

Reviewed the complete 31-file delta and discussion. The prior catalog rollback panic is resolved; size admission, rollback completion and cleanup have no actionable unresolved findings.

Model: gpt-6-astra / xhigh

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

Validation:

  • Isolation preflight and native prerequisite build passed.

  • 14 focused tests across seven packages passed, including catalog rejection and subsequent commits.

  • Nine lifecycle/concurrency tests passed with -race -count=10: 90 executions.

  • Reused frozen-head CI successes for unit tests, static analysis and both enabled multi-CN BVT jobs.

  • check-ledger.json reconciles receipts and retained logs. Final audit confirmed unchanged source and complete discussion-assessment.json coverage.

Limitations:

  • Local checks used small injected thresholds; no oversized SQL/TKE workload or performance benchmark was repeated.

  • CI evidence is the supplied status snapshot; historical remote validation logs were not independently available.

@mergify

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

35 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Wed 28 Oct, 12:24 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 12:58 · 287985e

Reason

Pull request #31380 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

Times in UTC · dashboard · how the merge queue works

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

dequeued kind/bug Something isn't working size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: WAL 消息超过 100 MiB 后 DN panic 重启,TP/AP 提交状态未知

4 participants