Skip to content

fix(tae): complete WAL waiters before append fail-stop - #28014

Merged
XuPeng-SH merged 9 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/tae-wal-waiter-terminal
Sep 3, 2026
Merged

XuPeng-SH merged 9 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/tae-wal-waiter-terminal

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Code Refactoring

Which issue(s) this PR fixes:

issue #28013

Related to issue #27945.

What this PR does / why we need it:

Problem

An accepted TAE WAL entry can wait indefinitely when serialization, callback, client acquisition, worker submission, or LogService append fails before the normal commit wait loop publishes its terminal state. Driver shutdown can also consume two independent timeout windows and then enter another unbounded wait.

Changes

  • Make groupCommitter the single completion owner for every accepted entry in the group.
  • Complete accepted waiters exactly once for success and every pre-append/append failure path, then clear the owned entry list so reset and close cannot notify twice.
  • Preserve the existing ordered success notification and committed-DSN behavior; failed committers do not advance the committed watermark.
  • Keep ants worker submission non-blocking for close safety, but retry ErrPoolOverload during normal worker handoff until the worker is reusable; closeC aborts that retry during shutdown.
  • Return clients and balance pending accounting on rejected or close-aborted submission.
  • Start one shared four-minute close deadline before stopping intake and use it for both worker and waiter drains; do not perform an unbounded second wait after expiry.
  • Propagate a WAL close error through TAE DB and TN replica shutdown so the service layer can fail-stop before closing LogService.
  • Keep the existing append-error fail-stop and unknown-commit semantics.

Compatibility and non-goals

Validation

  • Exact PR base/head: ffc8d9f0625c76e87ba967984ce19db2d082b0ba → 3b261e26737c3834ec71699c842bbb16bcca2c12.
  • The final revert commit changes no files relative to the repaired tree 6d7c8be5988f0afcc994662dd1cdeb21f74091c7; the net PR diff is 7 files, 537 insertions, and 35 deletions.
  • mo-cgo-test -list names all three new lifecycle tests; each focused test passed under -race -count=10:
    TestCommitSubmissionWaitsForWorkerHandoff, TestSubmitCommitWaitsAfterCommitterCompletion, and TestCloseDeadlineIncludesIntakeAndWorkerDrain.
  • The full pkg/vm/engine/tae/logstore/driver/logservicedriver owning-package race run passed at the same repaired tree.
  • git diff --check passed; semantic preflight schema v6 passed at this exact head with diff hash f871859479cb5b9f8578b97b69113ce224c930719ab871339582024859e42115.
  • BVT: N/A — SQL BVT cannot deterministically inject WAL serialization, client acquisition, worker submission, or LogService append failure and then assert the internal waiter terminal before fail-stop.
  • CI for the current exact head is running; no current CI or QA closure is claimed here.

QA decision

  • QA required: yes.
  • Reason: this changes durability waiter completion, fail-stop, close-race, hang, and unknown-commit boundaries.
  • Production entrypoint: accepted TAE group commit encountering an internal pre-append or LogService append terminal while the driver is running or closing.
  • Automated terminal coverage: package/race tests include the production commit/wait loop and injectable failure terminals, plus deterministic worker-handoff coverage for the P1 repair.
  • Remaining before merge and issue closure: required human code review; include this head in the A+B+C integration branch lifecycle check.

This PR is Ready for review. Human review, current CI, and the integration lifecycle check remain required before merge and issue closure.

大雾重重 added 3 commits April 24, 2026 13:59
- Rename sample types to alloc_objects, alloc_space, inuse_objects, inuse_space; default inuse_space
- Set PeriodType, Period, TimeNanos, and Mapping.HasFunctions in Profiler.Write
- Add heap_profiler_pprof_test for profile.Parse round-trip
- Add [malloc] block to mo_checkin_regression_tke.yaml for tp/dn

Made-with: Cursor
@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Sep 2, 2026
@mergify mergify Bot added kind/bug Something isn't working kind/refactor Code refactor labels Sep 2, 2026
@VioletQwQ-0

Copy link
Copy Markdown
Collaborator Author

针对本轮语义预检已推送修复(head 26ace131c60b6c31b008d4df845057e1d038b418):

  • WAL driver Close deadline 在 commitLoop.Stop() 之前创建,并覆盖 intake、worker submission 和 waiter drain;到期不再继续销毁仍被依赖的 client/pool。
  • worker pool 使用 nonblocking submission;close race 或容量耗尽时 accepted committer 立即收到一次 terminal error,不再阻塞在 workers.Submit。
  • rejected submission 会归还 client;wait loop 对已归还 client 做 nil-safe 处理。
  • 新增 production asyncCommit submission-failure 测试,验证 waiter 完成与 client 归还。

本地 mo-cgo-test ./pkg/vm/engine/tae/logstore/driver/logservicedriver、race -count=1、focused race -count=10、go vet、git diff --check 已通过。PR 仍保持 Draft;exact-head CI 正在运行,未宣称 QA/Ready。

@VioletQwQ-0

Copy link
Copy Markdown
Collaborator Author

补充修复已推送,当前 exact head 为 e9fad734911017fccc296593873e083537980aa4。

针对此前“生产链路未覆盖”的意见,本 head 新增 TestCommitSubmissionFailureRunsThroughWaitLoop:用真实 LogServiceDriver.onCommitIntents → ants worker Submit → commitWaitLoop 链路构造首个 append 阻塞、第二个 accepted committer 的 non-blocking submission failure,验证第二个 waiter 得到 error、client 归还、首个 append 释放后 wait loop 按顺序完成,pendingWait 最终归零。此前的 entry-level exactly-once 测试仍保留。

新增验证:

  • mo-cgo-test -run='TestCommitSubmissionFailureRunsThroughWaitLoop|TestAsyncCommitSubmissionFailureCompletesWaiterAndReleasesClient' -count=10:PASS
  • mo-cgo-test -race -run='TestCommitSubmissionFailureRunsThroughWaitLoop' -count=10:PASS
  • 既有 logservicedriver package、full race、focused race、vet:均已在本轮修复前后通过。

PR 仍保持 Draft;待 CI 和 exact-head semantic preflight 重新完成后再请求正式 review。

…-waiter-terminal"

This reverts commit 524a40a, reversing
changes made to 6d7c8be.
@CLAassistant

CLAassistant commented Sep 3, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ XuPeng-SH
✅ VioletQwQ-0
❌ 大雾重重


大雾重重 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@VioletQwQ-0

Copy link
Copy Markdown
Collaborator Author

Addressed both P1 findings at exact head 3b261e26737c3834ec71699c842bbb16bcca2c12 (base ffc8d9f0625c76e87ba967984ce19db2d082b0ba).

  • Normal ErrPoolOverload during the interval after finishCommit() publishes doneC is now retried until ants worker reuse, so a healthy next committer no longer becomes a fail-stop error.
  • closeC aborts that retry during shutdown, preserving the bounded shared close deadline and the in-flight unknown-durability rule.
  • Added deterministic coverage for the two-committer handoff and the paused doneC/worker-reversion window; TestCloseDeadlineIncludesIntakeAndWorkerDrain also covers close abort. Each passed under mo-cgo-test -race -count=10; the owning package race run passed.
  • Semantic preflight schema v6 and git diff --check pass. Current CI is running; QA/integration validation remains pending.

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

Deep re-reviewed exact head 3b261e2 against base ffc8d9f.

The previous normal-traffic worker-handoff blocker is resolved. Submit now retries only ants pool overload and is interrupted by closeC; the deterministic tests cover both a saturated worker and the narrower interval after committer completion but before worker reuse. A close racing that retry returns an explicit terminal to the accepted entry and does not advance the committed DSN.

I audited Q1-Q3 across successful append, pre-append/append error, client acquisition, worker handoff, Close during an in-flight append, deadline expiry, and repeated Close. groupCommitter/LogEntryWriter has one entry owner; the first error notification clears the owned list, later wait-loop cleanup is idempotent, client return remains ordered after worker completion, and pending accounting reaches zero before normal teardown. The shared deadline starts before intake stop and no unbounded follow-up wait remains. WAL close errors propagate through DB, TAE storage, replica, and TN store shutdown.

Performance impact is bounded: no per-entry goroutine is added, the writer mutex is uncontended under its single-owner flow, and the 1 ms retry path is limited to worker saturation/handoff rather than the normal append body. I found no remaining correctness, leak, double-completion, hang, shutdown, or material performance blocker. Exact-head UT, SCA, coverage, proxy BVT, and pessimistic multi-CN BVT are green.

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 kind/refactor Code refactor size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants