Repository navigation
[Bug]: CDC duplicate-reader UT cancellation can return no watermark found #30205
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Searches of open and closed issues covered the exact test name, DuplicateReader, no watermark found, CDC watermark cancellation, and CDC duplicate reader cancel. No issue covering this exact unit-test failure was found.
Branch Name
fix/30152-abs-negative-zero (PR #30168, targeting main)
Commit ID
Other Environment Information
- Observed CI: Ubuntu/x86, Go 1.27.1, CGo, short/race mode, matrixone_test build tag.
- Run 38535252841, attempt 1: https://github.com/matrixorigin/matrixone/actions/runs/38535252841
- UT job 115760279540: https://github.com/matrixorigin/matrixone/actions/runs/38535252841/job/115760279540
- Aggregate CI Required failure: https://github.com/matrixorigin/matrixone/actions/runs/38535252841/job/115842130781
- PR: fix: normalize signed zero in ABS #30168
Actual Behavior
TestTableChangeStream_Run_DuplicateReader fails at pkg/cdc/table_change_stream_test.go:477 after cancelling the first stream:
Error: Target error should be in err chain:
expected: "context canceled"
in chain: "internal error: no watermark found"
--- FAIL: TestTableChangeStream_Run_DuplicateReader (0.11s)
The complete failed-job log records this sequence:
10:19:33.319287 cdc.table_stream.start
10:19:33.331045 cdc.table_stream.duplicate_running
10:19:33.424673 cdc.progress_monitor.register
10:19:33.424965 cdc.table_stream.get_last_sync_time_failed: context canceled
10:19:33.425584 cdc.table_stream.process_failed: internal error: no watermark found
Source analysis: the readiness predicate accepts the runningReaders registration, which precedes progress registration and calculateInitialDelay/watermark initialization. Cancellation can therefore interrupt initialization before the collect-ready barrier. calculateInitialDelay logs and continues after the cancellation error; if the ticker and cancellation are both ready, the loop can process a round with no watermark. The test then observes ErrNoWatermarkFound rather than its allowed cancellation result. This is a scheduling-dependent startup/cancellation test-contract candidate, not a proven pure infrastructure fault.
Expected Behavior
The duplicate reader exits without replacing the existing reader; cancelling the original stream has a deterministic terminal contract. Readiness, initialization and cancellation should not leave the assertion dependent on whether a ready ticker wins selection. Preserve the duplicate-owner assertions and bounded termination; do not hide the issue with sleeps/retries/skips or a weakened unrelated assertion.
Steps to Reproduce
Original CI entry:
make ut UT_CONFIGURED=1 UT_PARALLEL=6 UT_TIMEOUT=40 UT_SHARD=allFocused diagnostic command (repository CGo wrapper):
.agents/skills/mo-dev/scripts/mo-cgo-test -v -short -race \
-tags=matrixone_test -count=3 -p=1 -timeout=600s \
-run '^TestTableChangeStream_Run_DuplicateReader$' ./pkg/cdcAdditional information
Classification: non-PR flaky/test-contract candidate under the four-part control protocol; not a claim that the Linux failure reproduced on main or is fixed.
- The complete failed-job log was downloaded and inspected. The CDC failure is the timing-dependent error-chain assertion above, not a compile/type/static/security failure; no panic or data-race report was present.
- At exact PR head
a579075a8abdc954e93bd08216fca6e602532b1f, the exact CDC test passed 3/3, with a terminal CDC-package result (2.703s), retaining short/race/matrixone_test/CGo. Actual command:
.agents/skills/mo-dev/scripts/mo-cgo-test -v -short -race -tags=matrixone_test -count=3 -p=1 -timeout=600s -run '^(TestTableChangeStream_Run_DuplicateReader|TestIssue29400CopyAlterRetainedGatePromotionFastFails)$' ./pkg/cdc ./pkg/tests/issues
The regex selects one root test in each owning package; all three CDC root passes were explicitly counted. The combined command was intentionally stopped later during the optional DDL dependency build (overall exit 143), after the CDC package had completed successfully. No DDL test had executed and no DDL pass is claimed; [Bug]: CI shared deadline expires in retained-gate promotion test #30161 supplies the independent evidence for that failure. - The full PR diff and the causal failure path exclude CDC initialization, watermark lookup, cancellation, test fixture and CI scheduling changes; details below.
- In a clean isolated worktree of freshly fetched official
up/main,fd4767e488dc111db02c9119cd46dfe78af1ee23, the same exact CDC test passed 3/3, terminal exit 0 (3.080s), using the same wrapper, Go 1.27.1, native inputs and flags, with-run '^TestTableChangeStream_Run_DuplicateReader$' ./pkg/cdc.
Local controls ran on Darwin/arm64, not the failing Linux/x64 runner. The race/tag/CGo and selection evidence supports this bounded flaky-candidate classification; it does not establish Linux/full-suite stability. Neither test nor production code was changed to force a green result.
The full CI log contains two failing root tests, without build/type/static failures, panic or a reported data race. The other root test has independent tracking in #30161. The five-file PR diff only normalizes floating-point signed zero in AbsSigned and adds its scalar/array/SQL regression coverage. It changes no CDC code, watermark initialization/cancellation, this test's harness, or the UT scheduler. The failure path and mocked watermark lookup do not evaluate ABS. CDC sources and the failing test are byte-identical between the PR head and the current official-main control. The exact-head momath and moarray owning packages also passed with short/race/tags/CGo; exact-head SCA, UT coverage, and both selected BVT lanes passed in CI.
Classification and Linux/full-suite limitations must remain explicit. After recording this issue and the #30161 occurrence, rerun only the failed jobs of run 38535252841 once; a repeated failure requires renewed attribution rather than an automatic rerun loop.
Activity
iamlinjunhong commentedon Oct 15, 2026
Additional occurrence on PR #30262 at exact head
e3bbdab3033396408c91da8cb432d2647f25f927(branchfix/csv-external-integer-whitespace). Run 38693888707, attempt 1 is complete. This meets the approved known-open-defect comparison path; it does not claim the CDC defect is fixed.The complete logs of all three failed jobs were read:
pkg/cdc/TestTableChangeStream_Run_DuplicateReader, attable_change_stream_test.go:477.prerequisites_ready=false; reports that a required producer did not publish a complete profile. No coverage verdict was calculated.verifyResultsrejectsmatrixone-ut-coverage: failure. The other UT/SCA and both selected BVT lanes succeeded.Stable root signature:
The log follows the mechanism already analyzed in this issue: first-reader registration, duplicate-reader rejection, delayed progress registration,
get_last_sync_time_failed: context canceled, thenprocess_failed: internal error: no watermark found. The coverage command wasgo test -mod=readonly -count=1 -json -short -v -tags matrixone_test -timeout=20m -p 8 -covermode=set, with the producer's generated-coverpkg, profile path and package scope, using CGo. The incident report records exit 1 and only two fail events: this test and its enclosing CDC package. This is an assertion failure, not a build/static/security failure or an observed data race.Comparison and causal isolation:
a579075a8abdc954e93bd08216fca6e602532b1f; the job API independently confirms failure on the amd64 runner.up/main461bc8e34920959e5fc141e3d1b37673a90894e1.getLastSyncTime/GetOrAddCommittedand the subsequentprocessWithTxn/GetFromCachelookup, beforeCollectChanges. The test stubs transaction, relation and SQL entry points. This causal path does not execute the changed CSV parser, external scan or decimal conversion wrapper, despite broader transitive package imports.pkg/sql/colexec/external(36.162s),pkg/sql/plan/function(12.974s), andpkg/sql/util/csvparser(2.330s). Named PASS events includeTestGetColDataExternalCSVIntegerRounding,TestGetColDataIntegerRoundingScope,TestCSVErrorModeTolerates,TestParseDecimalInteger,TestWhitespaceOnlyRecordandTestRecordLine. Exact-head normal Ubuntu UT, SCA and both selected BVT jobs also passed.The existing focused reproduction entry in this issue remains applicable. No new local Linux reproduction is claimed; the independent Linux occurrence plus matching mechanism and exact-head changed-closure evidence supply the permitted known-defect comparison. No CDC assertions or unrelated product code were modified. Only failed jobs of run 38693888707 will be rerun once after this evidence is recorded; any repeated signature requires renewed attribution rather than an automatic rerun loop.
XuPeng-SH commentedon Oct 17, 2026
Verified on latest official main b111224, Linux/amd64 Go1.27.1 with CGo, short/race/matrixone_test. The fixture now waits for blockingChangesHandle.Next to publish readiness after watermark initialization, then checks duplicate-reader ownership and only then cancels the first reader. Registration alone is no longer treated as initialization completion. The original pre-watermark cancellation ordering is excluded by this barrier; the context.Canceled and reader-slot-release assertions remain.
The exact TestTableChangeStream_Run_DuplicateReader passed once (root0.20s), then passed all100 focused race iterations with -count=100 -timeout=2m. Closing this fixture-ordering defect; this does not claim all possible CDC watermark failures are resolved.