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
{{ message }}
Repository navigation
[Bug]: Race UT TestLoopWork assumes all entries are consumed within 400ms #28778
Searched open and closed issues for TestLoopWork/valid_entries and did not find a matching issue.
Observed behavior
In PR #28740 UT run 34681517114, pkg/datasync.TestLoopWork/valid_entries failed at consumer_test.go:935 and :938:
expected syncedLsn 30, got 13;
expected required LSN 31, got 0.
The test writes 30 records, starts c.loop, raises the watermark after a fixed 200 ms, then cancels after another 200 ms. The race UT runner only processed 13 records before cancellation, so the assertions depend on all asynchronous work completing within a fixed 400 ms window. This is evidence of a scheduler-sensitive test assumption; only one failing run is currently confirmed, so same-head fail/pass evidence is still needed before classifying it as intermittent.
Expected behavior and investigation
Keep the coverage that the consumer handles all valid entries and advances the required LSN, but synchronize the test on observable progress or a bounded completion condition instead of assuming the worker processes 30 entries within 400 ms. Do not relax the expected record count or disable race coverage.
This test failure is unrelated to PR #28740's code changes.
Reproduced again on the 4.2-dev release line, which does not include the deterministic rewrite from #29673 — evidence the race is still live on that branch.
Steps/context:TestLoopWork/valid_entries writes 30 records with syncedLsn=10; the test goroutine raises writeLsn after 200 ms and cancels after another 200 ms, assuming the consumer loop() (10 ms ticker) finishes all mock-log consume+file cycles within that fixed 400 ms window while the whole UT suite runs in parallel.
Observed failure:consumer_test.go:935 — expected syncedLsn 30 (0x1e), actual 15 (0xf); consumer_test.go:938 — expected required LSN 31 (0x1f), actual 0. Same partial-consumption signature recorded in this issue (13/30 on PR fix: honor IGNORE conversion warnings #28740). It was the only UT failure of the run (FAIL_UT_CASES=TestLoopWork,TestLoopWork_valid_entries).
Unrelated to PR [4.2-dev] fix(sql): preserve complete strings and serialized JSON in omitted-length CAST AS CHAR #32438: that PR touches only SQL-layer packages (pkg/sql/colexec, pkg/sql/parsers/dialect/mysql, pkg/sql/plan/**) and BVT result files; pkg/datasync is untouched by it, and this test exercises only mock log clients + fileservice with no SQL execution. go test ./pkg/datasync -run TestLoopWork -count=10 -timeout=15m passes 10/10 at head 768075a0c8 locally. The same run's coverage-mode UT job and all BVT/Compose/Upgrade jobs were green, and the CI Required aggregate failed only as a consequence of this single flake.
Activity
fix: make aggregate states version compatible (#28885)
gouhongshen commentedon Nov 17, 2026
Reproduced again on the
4.2-devrelease line, which does not include the deterministic rewrite from #29673 — evidence the race is still live on that branch.pull_request_target, head768075a0c8(PR [4.2-dev] fix(sql): preserve complete strings and serialized JSON in omitted-length CAST AS CHAR #32438, base4.2-dev), job completed 2026-11-17T13:54:43Z.TestLoopWork/valid_entrieswrites 30 records withsyncedLsn=10; the test goroutine raiseswriteLsnafter 200 ms and cancels after another 200 ms, assuming the consumerloop()(10 ms ticker) finishes all mock-log consume+file cycles within that fixed 400 ms window while the whole UT suite runs in parallel.consumer_test.go:935— expectedsyncedLsn30 (0x1e), actual 15 (0xf);consumer_test.go:938— expected required LSN 31 (0x1f), actual 0. Same partial-consumption signature recorded in this issue (13/30 on PR fix: honor IGNORE conversion warnings #28740). It was the only UT failure of the run (FAIL_UT_CASES=TestLoopWork,TestLoopWork_valid_entries).pkg/sql/colexec,pkg/sql/parsers/dialect/mysql,pkg/sql/plan/**) and BVT result files;pkg/datasyncis untouched by it, and this test exercises only mock log clients + fileservice with no SQL execution.go test ./pkg/datasync -run TestLoopWork -count=10 -timeout=15mpasses 10/10 at head768075a0c8locally. The same run's coverage-mode UT job and all BVT/Compose/Upgrade jobs were green, and theCI Requiredaggregate failed only as a consequence of this single flake.