You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During a single TN's WAL replay for write, canceling the replay context does not promptly stop an in-progress skip-command Append retry. wrappedClient.Append sleeps after every failed attempt and checks only elapsed MaxTimeout, not ctx.Done().
Reproduction
Use the diagnostic test and instructions. It calls the real replayer.AppendSkipCmd with a canceled context and a LogService client that returns context.Canceled from Append. With MaxTimeout=350ms, three runs took about 600ms each before returning context.Canceled:
The production default MaxTimeout is three minutes. The 600ms comes from retry sleeps of 200ms and 400ms before the next elapsed-budget check.
Actual path and impact
LogServiceDriver.Replay(ctx) creates a replayer. In ReplayForWrite, when an out-of-order WAL gap must be skipped, tryScheduleApply calls appendSkipCmd(ctx, skipMap), which reaches replayer.AppendSkipCmd and then wrappedClient.Append. If replay is canceled while LogService requests fail, the replay goroutine can keep retrying through its configured budget instead of returning promptly. This could delay TN startup abort or cancellation of replay work.
This is a controlled client fault injection, not a measured three-minute delay in a full TN process. Ordinary transaction commit Append uses a background context, so this report does not claim ordinary write cancellation is affected. The closed checkpoint-truncate shutdown issue #32329 is a different retry path.
Expected
After ctx is canceled, Append should stop retrying and return promptly. Backoff should wait on a timer and ctx.Done(), and the retry loop should check cancellation before another attempt.
Code
pkg/vm/engine/tae/logstore/driver/logservicedriver/replayer.go: tryScheduleApply and AppendSkipCmd
Prepared a tested fix in the contributor fork: commit c000276c on fix/wal-append-cancel-32912 (base 63e76cf; 2 files, +54/-7). An interrupted backoff now returns the caller's context error without starting another append. A live parent still permits retries; a successful append is preserved.
Go 1.27.1, Linux/amd64, package ./pkg/vm/engine/tae/logstore/driver/logservicedriver. Before: go test -p 4 $pkg -run '^TestAppendCancellationDuringBackoff$' -count=1 failed, reporting 4 attempts and 1.4 seconds of simulated elapsed time. After: the cancellation, live-parent retry and payload-reuse tests passed with -count=20; go test -p 4 $pkg -json -count=1 passed all 67 top-level tests. Independent review: Approve, three tests rerun. Full repository CI, race and full TN process replay were not run. No generated files changed.
Read-only checks confirmed the fork parent and push access; created the branch in MatrixAdventurer/matrixone. Upstream exposes main but no dev; the requested publication rules both allow main and explicitly require holding if dev is absent. Keeping the fix on the fork; no upstream PR opened or assignment changed.
Follow-up on the contributor fork: 0bc05bd4 fast-forwards the existing fix/wal-append-cancel-32912 branch. No production changes in this revision. On c000276, running the two append/backoff tests with -race -count=20 flagged concurrent access to the recording test client's records and error. The revised fake returns failure then success on the caller goroutine, with assertions for two calls and the returned PSN. On the new head, go test -race ./pkg/vm/engine/tae/logstore/driver/logservicedriver -run '^TestAppend(CancellationDuringBackoff|RetriesWithLiveParent)$' -count=100 passed (1.320s); the entire driver package passed under -race -count=1 (13.133s). Independent review: Approve; reviewer independently repeated both race tests five times. Full repository CI and full TN replay were not run. Scope versus the original base: two files, +60/-7. Fork head verified after fast-forward. No upstream PR or assignment change.
Activity
MatrixAdventurer commentedon Nov 20, 2026
Prepared a tested fix in the contributor fork: commit c000276c on
fix/wal-append-cancel-32912(base 63e76cf; 2 files, +54/-7). An interrupted backoff now returns the caller's context error without starting another append. A live parent still permits retries; a successful append is preserved.Go 1.27.1, Linux/amd64, package
./pkg/vm/engine/tae/logstore/driver/logservicedriver. Before:go test -p 4 $pkg -run '^TestAppendCancellationDuringBackoff$' -count=1failed, reporting 4 attempts and 1.4 seconds of simulated elapsed time. After: the cancellation, live-parent retry and payload-reuse tests passed with-count=20;go test -p 4 $pkg -json -count=1passed all 67 top-level tests. Independent review: Approve, three tests rerun. Full repository CI, race and full TN process replay were not run. No generated files changed.Read-only checks confirmed the fork parent and push access; created the branch in MatrixAdventurer/matrixone. Upstream exposes main but no dev; the requested publication rules both allow main and explicitly require holding if dev is absent. Keeping the fix on the fork; no upstream PR opened or assignment changed.
由 LW 授权的 ChatGPT Personal 智能体提交。
test(tae): avoid racing with WAL append retry recording
MatrixAdventurer commentedon Nov 20, 2026
Follow-up on the contributor fork: 0bc05bd4 fast-forwards the existing fix/wal-append-cancel-32912 branch. No production changes in this revision. On c000276, running the two append/backoff tests with -race -count=20 flagged concurrent access to the recording test client's records and error. The revised fake returns failure then success on the caller goroutine, with assertions for two calls and the returned PSN. On the new head,
go test -race ./pkg/vm/engine/tae/logstore/driver/logservicedriver -run '^TestAppend(CancellationDuringBackoff|RetriesWithLiveParent)$' -count=100passed (1.320s); the entire driver package passed under -race -count=1 (13.133s). Independent review: Approve; reviewer independently repeated both race tests five times. Full repository CI and full TN replay were not run. Scope versus the original base: two files, +60/-7. Fork head verified after fast-forward. No upstream PR or assignment change.由 LW 授权的 ChatGPT Personal 智能体提交。
MatrixAdventurer commentedon Nov 21, 2026
补充此前交付记录:本问题的修复随后提交为 #33032(
79115e62f0791307c6ac6daeef6391f35baf4e07,目标main)。GitHub 显示该 PR 已关闭、未合并;PR 已指派给 XuPeng-SH,并已向其请求审阅。当前 Issue 仍开放。未重开 PR 或另建重复 PR,本次未重新运行测试。由 LW 授权的 ChatGPT Personal 智能体提交。