Skip to content

[Bug]: [flaky] multi-CN index rebuild UT: copy-alter (flush=false) loses column note on cn1 (TestIssue29566IndexRebuildCoordinator) #31042

Closed

Description

@XuPeng-SH
  • I have checked the existing issues.

Branch Name

main

Commit ID

d8d0e2fc (observed in the CI run of PR #31022, which executes on the merge of main@d8d0e2fc with the PR head)

Other Environment Information

  • Hardware parameters: GitHub-hosted runner, x86_64
  • OS type: Ubuntu 22.04
  • Others: UT Test job, parallel multi-CN (MOC) cluster with 2 CNs, as used by pkg/tests/sqlintegration/multicn

Actual Behavior

The multi-CN index rebuild coordinator UT fails intermittently on one subcase:

--- FAIL: TestIssue29566IndexRebuildCoordinator/copy_alter/flush_false/cn1 (2.94s)
    Error Trace: pkg/tests/sqlintegration/multicn/index_rebuild_test.go:103
                 pkg/tests/sqlintegration/multicn/index_rebuild_test.go:303
    Error:       Received unexpected error:
                 Error 1054 (42S22): invalid input: column note does not exist
    Messages:    select id,note from copy_vectors_false order by id
--- FAIL: TestIssue29566IndexRebuildCoordinator/copy_alter/flush_false (5.34s)
FAIL_UT_CASES=TestIssue29566IndexRebuildCoordinator,TestIssue29566IndexRebuildCoordinator_copy_alter_flush_false_cn1,TestIssue29566IndexRebuildCoordinator_copy_alter_flush_false
FAIL: exit code 2

After the copy-alter index rebuild on the unflushed table, selecting the backfilled column note fails on the second CN (cn1) with "column note does not exist".

Failing run: https://github.com/matrixorigin/matrixone/actions/runs/40075364835/job/120834725794 (run #4346430)

All sibling subcases in the same run PASS, only flush=false + cn1 fails:

  • .../copy_alter/flush_false/cn0 PASS
  • .../copy_alter/flush_true/cn0 PASS
  • .../copy_alter/flush_true/cn1 PASS
  • .../fulltext2, .../hnsw PASS

Expected Behavior

All subtests pass: after the copy-alter index rebuild, the backfilled note column must be visible on every CN node regardless of the table's flush state.

Steps to Reproduce

# multi-CN parallel-MOC environment, same as the UT workflow job
# (see docs/ut-test.md / install_moc workflow); then:
cd pkg/tests/sqlintegration/multicn
go test -run 'TestIssue29566IndexRebuildCoordinator/copy_alter' -count 1

Intermittent: so far only observed on copy_alter/flush_false/cn1.

Additional information

Activity

  1. added
    kind/bug
    and removed on Oct 24, 2026
  2. self-assigned this
    on Oct 24, 2026
  3. XuPeng-SH commented on Oct 24, 2026

    @XuPeng-SH
    ContributorAuthor

    Fix proposed in #31059. The exact failing SELECT at the reported line 303 executes on CN0 after CN1 commits; cn1 is the coordinator subcase name. A successful commit does not by itself advance another CN's catalog snapshot.

    The test now waits for the reader's applied timestamp to cross the writer's commit at all committed fixture handoffs, using the existing transaction-client waiter and the remaining test budget. Unflushed inputs, pending transaction-local rows/index writes, remote-owner execution, rollback and commit assertions are retained. No production COPY/index behavior changes.

    The complete root passes normally (8.630s) and under race (15.950s), including FULLTEXT2/HNSW and all four coordinator/flush combinations. Incremental vet/molint/configured lint pass; gpt-6.1-sol/xhigh design and final review pass. The isolated baseline did not reproduce the original intermittent failure; the correction establishes the missing observation ordering, rather than claiming a reproduced product defect. CI for the new PR is separate from these local results.

  4. gouhongshen commented on Oct 25, 2026

    @gouhongshen
    Contributor

    Independent reproduction on an unrelated disttae/compile-focused diff — same subcase, same line, same error (PR #30988, MatrixOne ALL CI run 40153614303, attempt 3).

    Workflow/job/run: UT Coverage on Ubuntu/x86, job 121085407379 of run 40153614303 (attempt 3), PR head a90f71ed779c814786c04b29034b91b781ee6e30 (PR #30988), self-hosted runner amd64-mo-guangzhou-2xlarge16-jvhxs-runner-fdp9h (Guangzhou amd64 pool). Checkout succeeded at 05:29:10Z and the lane executed the head's source: the whole 502-package coverage phase ran ({'start': 502, 'run': 87921, 'pass': 88328, 'fail': 4}, build failures 0) and the lane failed only in pkg/tests/sqlintegration/multicn, terminal failure at 2026-10-25T06:02:09Z.

    Observed failure (exact issue signature; the only test failing in the phase):

    --- FAIL: TestIssue29566IndexRebuildCoordinator/copy_alter/flush_false/cn1 (0.38s)
        Error Trace: pkg/tests/sqlintegration/multicn/index_rebuild_test.go:103
                     pkg/tests/sqlintegration/multicn/index_rebuild_test.go:303
        Error:       Received unexpected error:
                     Error 1054 (42S22): invalid input: column note does not exist
        Messages:    select id,note from copy_vectors_false order by id
    

    All sibling subcases passed in the same execution. The failing SELECT is the line-303 query executed right after exec(t, "commit") and conn = conns[0] — the CN0 read immediately following the CN1 commit. The terminal log shows its transaction opening its snapshot at 05:55:06.461172 while the ALTER-copy swap ran mid-flight in the async coordinator's transaction (started 05:55:06.45907): tn.handle.drop.relation {Id:272575 ... Name:copy_vectors_false} at .461832 and tn.handle.create.relation {272587-copy_vectors_false} at .462832. This is the cross-CN post-commit catalog-visibility ordering the #31059 test-only waiter addresses, not a schema or product defect; no go-test hang or panic occurred.

    Why it is unrelated to PR #30988: that diff is disttae long-transaction workspace maintenance and orphan-cleanup ownership (recorded-unpublished-names bookkeeping, object-name relay, remote-fragment admission) with no ALTER-copy/ISCP coordinator, catalog or schema-resolution overlap. The same test executed green in this same coverage lane on the PR's immediately preceding heads — run 40140629208 attempts 1–2 on 9f0c4e2ce7 (whole 502-package phase green 2026-10-25T00:46:19Z) and run 40130528379 attempt 1 on 967e0ace23 (UT Coverage SUCCESS 21:13:36Z) — whose only delta to the failing head is a disttae recorded-name holder refactor with no interaction with the racing path. On the failing head itself, every other executed lane of the same run was green (CI preflight, Build MatrixOne (shared), and both multi-CN BVT legs).

    Independent corroboration of the existing record from PR #31022 (string-grouping-only diff): the failure is timing-driven and independent of the diffs that trigger it.

  5. added a commit that references this issue on Oct 25, 2026
    1c9518b
  6. XuPeng-SH commented on Oct 26, 2026

    @XuPeng-SH
    ContributorAuthor

    Verified on current main 861a2c4cb68961d8b6b01f18e0aa6ac52a3a505f: the existing fix #31059 is merged, and the test waits for the remote reader to advance past the writer's committed frontier at committed handoffs. The failing SELECT is on CN0 after CN1 commits; the cn1 subtest name identifies the coordinator.

    The complete TestIssue29566IndexRebuildCoordinator root passes normally (8.133s) and under -race (24.213s), including all copy-alter coordinator/flush combinations and FULLTEXT2/HNSW controls, on Linux/amd64 with Go1.27.1 and verified native CGo artifacts. Inputs/assertions were unchanged. Closing as covered by the merged fix and current-code verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions