Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
main
Commit ID
Incident: 5a96035fc792b07b7a28e2f509dc0dcd4236e048.
The relevant CDC code is unchanged at reviewed current main b9013dc6bb058ec74935a62ac3a35f57d13c2f98.
Other Environment Information
- TKE nightly regression, run 36335119263, CDC job 108722779810.
- Namespace:
mo-main-family-36335119263-1. - Source CDC executor CN:
nightly-regression-dis-tp-cn-krqql. - MO-to-MO CDC, TPCC source
tpcc_10, targettke_family_tpcc_sink. - Task:
tke_family_tpcc_36335119263_1, ID01a0e500-91c5-799f-a607-e04e3462e1a5. - All times below are UTC on 2026-09-27; add eight hours for 2026-09-28 CST.
Actual Behavior
A transient pipeline-setup error is persisted as a non-retryable table error on its first occurrence, and the table detector then fails and stops the entire CDC task. This is not merely slow catch-up or a client convergence timeout.
The decisive table is bmsql_history. The observed sequence is:
| UTC | Evidence |
|---|---|
| 22:39:15.784 | Initial TPCC source/target digest matches for three consecutive checks. |
| 22:40:10.702 through 22:40:30.459 | Existing history reader reports target ownership lock poll exceeded 2s on repeated attempts. |
| 22:41:25.047639 | Frontend still classifies history's existing lock error as retryable: retry-count=1, max-retry=3. |
| 22:41:47.657886 | cdc.frontend.task.add_exec_pipeline_failed, history, with context deadline exceeded\nsql: connection is already closed. |
| 22:41:47.692405 | cdc.watermark.update_errmsg_persist, same task/table: retryable=false, retry-count=1, formatted-msg="N:1790548907:internal error: context deadline exceeded\nsql: connection is already closed". |
| 22:42:36.050907 | Frontend detects that same permanent history error, age approximately 49 seconds. |
| 22:42:46.383494 | cdc.frontend.task.failed_by_permanent_table_error, same task ID and history table. |
| 22:43:18.094 through 22:58:15.358 | Post-write TPCC convergence checks remain unchanged and fail. |
Observed source/target differences after source writes stop:
| Table | Source rows | Target rows | Difference |
|---|---|---|---|
| bmsql_oorder | 301286 | 300992 | 294 |
| bmsql_order_line | 3013886 | 3010928 | 2958 |
These differences establish stopped replication and stale downstream data. They do not prove irreversible source data loss or that replay after recovery would fail.
Expected Behavior
With the task generation still valid and the callback context alive, a transient target setup/connection or advisory-lock release timeout should retire the failed connection and enter the existing bounded retry/rebuild policy. It should not immediately be classified as a permanent schema/data error solely because the returned error lacks a CDC wrapper.
Real schema/configuration errors must remain permanent. Cancellation, ownership loss, ambiguous DDL, and retry exhaustion must keep their distinct safety semantics; this report does not request blanket or unlimited retry.
Steps to Reproduce
The incident is captured in the linked CDC job and correlated service logs. Two smaller component validations target the production ownership-release and pipeline-error classification boundary, without rerunning the full daily workload:
- Keep the parent task/callback context live and the generation valid.
- Acquire a target lock using the real
Executortarget-lock path with a sqlmock database. - Make the target
RELEASE_LOCKresponse return a deadline error. - Observe connection discard/close and the joined error returned by
ReleaseTargetLock; source inspection confirms sink initialization returns it directly. - Separately, inject that error at
NewSinkerin the real frontendhandleNewTablespath. Read the persisted watermark row and exerciseGetTableErrMsgon its error metadata. - Keep successful release, explicitly wrapped transient errors, and a genuine permanent SQL error as controls.
Executed on current main b9013dc6 in an isolated macOS arm64 worktree with Go 1.26.4 and matching freshly built CGo libraries. Temporary diagnostic tests were added, without production changes:
env -u LC_TERMINAL -u LC_TERMINAL_VERSION LC_ALL=C LC_CTYPE=C LANG=C \
.agents/skills/mo-dev/scripts/mo-cgo-test -count=3 -timeout=120s \
-run '^(TestCDCSetupErrorHarness|TestCDCNewTableSetupErrorClassificationHarness)$' \
./pkg/cdc ./pkg/frontendBoth packages passed three repetitions of the behavior assertions, including these controls:
| Probe | Observed current behavior |
|---|---|
Successful RELEASE_LOCK |
Success, pinned-lock reference cleared. |
Real RELEASE_LOCK query returns only context.DeadlineExceeded |
Production cleanup generates a joined deadline + sql.ErrConnDone, without a retryable CDC wrapper. |
Real non-retry setup ExecSQL receives a transport error |
Returned without a retryable wrapper. |
| Frontend receives raw joined deadline/closed-connection setup error with live callback | Persists N:, ShouldRetry=false, next GetTableErrMsg gate blocks. |
| Frontend receives syntax error | Persists N: and blocks, as expected. |
| Frontend receives typed retryable setup error | Persists R: and permits retry. |
These tests reproduce the defect, not a fix. The frontend fixture uses the legacy protocol and a stubbed NewSinker; the two tests are not a full stable-epoch/real-MySQL end-to-end reproduction. The incident's matching task/table logs establish the live stable-task failure. No package-wide test, race test, BVT, or new Daily was run.
Additional information
Confirmed code-level classification gap
At the incident revision:
createMysqlSinker2returns initialization SQL errors directly. After successful initialization, lines 278-281 likewise returnReleaseTargetLockerrors directly.Executor.releaseTargetLockuses an independent five-second cleanup context. A query error discards the pinned physical session, then joins the query error withsql.Conn.Close()'s error. That result has no retryable CDC wrapper.handleNewTablessetup-error handling correctly excludes obsolete/cancelled callbacks. For a live callback, however, itsIsRetryableexpression at lines 2905-2909 accepts only four specific CDC wrapper types. A raw or joined deadline/closed-connection error therefore evaluates false.UpdateWatermarkErrMsgpersists this supplied false classification asN:....- The next table discovery invokes
failTaskForPermanentTableError, marks the task failed and cancels the remaining readers.
Important evidence boundaries
- The runtime setup error -> non-retryable metadata -> whole-task failure chain is directly observed, with matching task/table identifiers.
- A target-lock release deadline can produce this exact error shape through the current production code. The archived logs do not include the individual target SQL/connection identifier for the history setup attempt, so its exact lower-level stalled SQL is not claimed as uniquely proven.
- The earlier two-second
GET_LOCKerrors are classified retryably. The decisive history error was notmax retry exceeded; it was a different setup error recorded withretryable=false, retry-count=1. cannot release target ownership lock with an active transactionis recorded for district, after history's permanent-error shutdown starts. It must not be substituted for the cause that failed history or used to assert a separate transaction leak without further evidence.- The initial target-side latency trigger remains undetermined; this issue is specifically about incorrectly escalating the recoverable setup failure.
Existing issues and regression status
- CDC TPCC 一致性校验失败: bmsql_order_line 同步滞后导致 oorder/order_line 数据不一致 #26949 tracks cross-table CDC lag. This incident includes explicit permanent task termination, so it is not a duplicate of lag alone.
- CDC task remains running while checkpoint stalls after permanent_table_error #25177 fixed a task remaining deceptively
runningafter permanent errors. Here the task correctly becomesfailed; the problem is the preceding classification of the transient error. - [Bug]: RESUME CDC TASK cannot clear a target-table error while task state is Running #26633 tracks the user-facing resume contract for an errored task still in
running, not this setup classification. - The reviewed head of open PR fix(cdc): fence target resets and reject keyless sources #28521 (
2768adadd75003f39733001e856d609b7dedb090) still uses the same four-wrapper setup classification. Its target identity/reset work should not be assumed to fix this issue. - No relevant CDC code changed between the previous daily's
b1b68925d7f6fb32153e788b5285f424222e85caand this incident. A new daily failure is not proof of a newly introduced daily regression. - The stable target-lock release path originates in fix(cdc): accelerate bounded initial snapshots #27939 (
061a343d71ad40299c5a5e4abcbbda1d4a6711fe, September 6). The broader default-permanent setup classification predates it. The evidence does not justify attributing all historical CDC lag or the underlying target slowdown to that PR.
Acceptance boundary
Validate target-release/transport timeout with a live parent context through both sink setup and frontend persistence; it must remain bounded-retryable. Retain checks that syntax/configuration failures remain permanent, lifecycle cancellation does not poison a newer owner, the failed physical connection is discarded, and repeated failures can still exhaust the configured retry policy.
Activity
fix(cdc): replay failed target transactions and preserve error accoun…