Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
#28931 and #32244 track the production CREATE INDEX/concurrent DML correctness problem. This issue is specifically about the regression test's missing cross-CN commit fence before index-dependent assertions; it is not a claim that the production data-loss race has returned.
Branch Name
main and 4.2-dev
Commit ID
main:c33ce3ff8e7555c8053c85693e55e93e73d898b7- Failing
4.2-devPR revision:efe8fb12e41da43bbc81689f58a96c3ae917b2e2
Other Environment Information
- GitHub Actions, Linux/x86 UT coverage job: https://github.com/matrixorigin/matrixone/actions/runs/44675005410/job/136084772464?pr=32964
- Embedded two-CN test cluster created by
TestIssue28931StaleUpdatePlanCannotBypassNewIndex. - The test uses a plan barrier to interleave an UPDATE on writer CN with CREATE INDEX on ddl CN.
Actual Behavior
The regular-index subtest can fail immediately after CREATE INDEX returns success:
Error 1176 (42000): Key 'ix_payload' doesn't exist in table 'regular_update'
The failing statement is executed on writer CN:
SELECT COUNT(*), COALESCE(SUM(id), 0)
FROM regular_update IGNORE INDEX(ix_payload)
WHERE payload = 'changed';On main, the subtest waits for ddlDone and immediately runs IGNORE/FORCE INDEX queries without a cross-CN commit fence:
matrixone/pkg/tests/issues/issue_28928_28931_test.go
Lines 151 to 172 in c33ce3f
| waitForPlan, release := issue289InstallPlanBarrier(t, ctx, issue289CreateIndexPlanCompiled, 1) | |
| ddlDone := make(chan error, 1) | |
| go func() { | |
| _, err := ddlDB.ExecContext(ctx, "create index ix_payload on "+table+" (payload)") | |
| ddlDone <- err | |
| }() | |
| waitForPlan() | |
| execSQLRequire(t, ctx, writerDB, "update "+table+" set payload = 'changed' where id = 1") | |
| release() | |
| require.NoError(t, <-ddlDone) | |
| var scannedCount, scannedSum, indexedCount, indexedSum int | |
| require.NoError(t, writerDB.QueryRowContext(ctx, | |
| "select count(*), coalesce(sum(id), 0) from "+table+" ignore index(ix_payload) where payload = 'changed'"). | |
| Scan(&scannedCount, &scannedSum)) | |
| require.NoError(t, writerDB.QueryRowContext(ctx, | |
| "select count(*), coalesce(sum(id), 0) from "+table+" force index(ix_payload) where payload = 'changed'"). | |
| Scan(&indexedCount, &indexedSum)) | |
| require.Equal(t, 1, scannedCount) | |
| require.Equal(t, 1, scannedSum) | |
| require.Equal(t, scannedCount, indexedCount) | |
| require.Equal(t, scannedSum, indexedSum) |
On the failing 4.2-dev revision, syncAuthenticatedClusterCommit is present but placed after those queries:
matrixone/pkg/tests/issues/issue_28928_28931_test.go
Lines 311 to 327 in efe8fb1
| waitForPlan, finishDDL := issue289StartPlanBlockedDDL(t, ctx, ddlDB, "create index ix_payload on "+table+" (payload)") | |
| waitForPlan() | |
| execSQLRequire(t, ctx, writerDB, "update "+table+" set payload = 'changed' where id = 1") | |
| require.NoError(t, finishDDL()) | |
| var scannedCount, scannedSum, indexedCount, indexedSum int | |
| require.NoError(t, writerDB.QueryRowContext(ctx, | |
| "select count(*), coalesce(sum(id), 0) from "+table+" ignore index(ix_payload) where payload = 'changed'"). | |
| Scan(&scannedCount, &scannedSum)) | |
| require.NoError(t, writerDB.QueryRowContext(ctx, | |
| "select count(*), coalesce(sum(id), 0) from "+table+" force index(ix_payload) where payload = 'changed'"). | |
| Scan(&indexedCount, &indexedSum)) | |
| require.Equal(t, 1, scannedCount) | |
| require.Equal(t, 1, scannedSum) | |
| require.Equal(t, scannedCount, indexedCount) | |
| require.Equal(t, scannedSum, indexedSum) | |
| syncAuthenticatedClusterCommit(t, ctx, cluster) |
Thus finishDDL()/<-ddlDone only establishes DDL completion on ddl CN. It does not establish that writer CN has applied and synchronized the corresponding commit timestamp.
Expected Behavior
After CREATE INDEX succeeds and before any index-dependent assertion, the test should establish the suite's existing cross-CN fence:
require.NoError(t, finishDDL()) // or require.NoError(t, <-ddlDone) on main
syncAuthenticatedClusterCommit(t, ctx, cluster)
// Run IGNORE INDEX, FORCE INDEX, and physical-index assertions only here.syncAuthenticatedClusterCommit waits for every CN's timestamp waiter to reach the maximum observed commitTS and calls SyncLatestCommitTS, which is the synchronization this cross-CN assertion requires.
The test should not use sleep or retry to hide the ordering problem.
Steps to Reproduce
- Run
TestIssue28931StaleUpdatePlanCannotBypassNewIndex/regular_index_includes_the_updatewith its existing plan barrier and two CN endpoints. - Pause CREATE INDEX planning on ddl CN and execute the writer UPDATE.
- Release CREATE INDEX and wait only for the DDL call to return.
- Immediately run
IGNORE INDEX(ix_payload)on writer CN, beforesyncAuthenticatedClusterCommit. - Depending on cross-CN apply timing, the query can fail with error 1176 instead of testing index/table result consistency.
Additional information
The CI log shows that the SELECT snapshot did not include the index commit:
CREATE INDEX snapshot/start = 1795150050975226628-1
CREATE INDEX commit = 1795150050977581583-0
SELECT snapshot = 1795150050975226628-1
This is consistent with the missing test fence. Move/add the fence immediately after DDL success on both branches. If the index is still absent after the fence, investigate production snapshot/catalog invalidation separately.
Related:
- Historical production correctness issue: [Bug]: concurrent CREATE INDEX can omit a successful UPDATE from the new index #28931
4.2-devproduction backport issue: [Bug]: [4.2-dev] CREATE INDEX is not serialized with concurrent DML (#29235 not backported) #32244- CI where this test failure was observed: [4.2-dev] Reduce CN catalog replay memory #32964
#32244 also records an earlier error-1176 observation whose root cause was left unresolved; this report does not assume that observation had the same cause without its own fence evidence.
Activity
[4.2-dev] fix(test): establish the cross-CN commit fence before TestI…
slyunnn commentedon Nov 23, 2026
Partially fixed — #32975 4.2-dev fence verified; main fix pending (2026-11-23)
Merged
4.2-devfix: #32977,53b3bc7c95c500de89a60001d947001c5d77d958—[4.2-dev] fix(test): establish the cross-CN commit fence before TestIssue28931 index queries.Verified latest fetched
4.2-dev@f811a8673b44f592e5f60db10843de119d662e89—fix(tae): bound catalog replay input memory (#33078), Go1.26.5on macOS/arm64. The correctedTestIssue28931StaleUpdatePlanCannotBypassNewIndexran twice, using its actual embedded two-CN MySQL clients and deterministic plan barrier. All six subtests passed in both runs (14parent/subtest pass events total), including regular-index visibility, stale unique conflict, admitted writers, rollback and canceled index creation. No1176occurred. Source inspection confirmssyncAuthenticatedClusterCommitruns immediately after successfulfinishDDL(), beforeIGNORE INDEX,FORCE INDEXand physical-index assertions. No sleep or retry substitutes for the fence.A separate full
2 CN / 1 TN / 1 Log service / Proxydeployment at the same service commit passed actual SQL and recovery checks on Proxy6001, CN116001, CN216002. Those endpoint checks are not presented as the internal plan-barrier test.The latest main source
e17d5541537d30252009a9a2d4c70ab5480d3bc3still lacks this fence immediately before the hinted queries. Its change from the initially fetchedf86cc46cfc5d5e4a0e2e52af6e4cbd58f9f9c449is the unrelated TN recovery port #33090. No merged main fence was found, so main regression was skipped, as requested. Suggested remaining action: merge the main counterpart with the same ordering; if visibility still fails after that fence, investigate catalog/snapshot invalidation separately.No additional large data is needed: the defect is deterministic cross-CN assertion ordering. The existing owning test already supplies the necessary barrier and timestamp waiter; a SQL-only MOTR duplicate would not assert either and was not added. This is not a claim that the historical production CREATE INDEX/DML issue has recurred or is fully revalidated.
Conclusion:
4.2-devtest-fence repair verified; main remains pending. Keep the issue open without acloselabel.fix(ci): stabilize main regression test phases (#33179)