Skip to content

[Bug]: retrying an interrupted 4.2→main upgrade panics in the View metadata admission fence #28004

Closed

Description

@Ariznawlll

Description

After an interrupted 4.2-dev to main catalog upgrade, retrying current main against the same persisted directory can panic before the v4.0.6 View-metadata catalog migration completes. This is a retry-convergence failure, distinct from the initial generic catalog-DDL hook tracked in #27967.

Environment

  • Branch: main
  • Commit: 804976d2ed85c15790b710db1141e06066284327
  • Baseline: 4.2-dev @ b2a873419200b3685fe4dd89401857440a0e145c
  • Deployment: local standalone 1 LogService + 1 TN + 1 CN; services were stopped between version switches and reused the same persistent data directory.

Steps to reproduce

  1. Start 4.2-dev and create ordinary user tables (the fixture included both a single-column and a composite foreign key).
  2. Stop 4.2-dev and start main using the same directory. Preserve the directory if this first main start exits while the v4.0.6 lifecycle catalog tables are still absent.
  3. Create three independent copy-on-write copies of that preserved directory.
  4. Start main @ 804976d2 once on each copy.

Actual behavior

All three current-main retries exit with code 2 in about six seconds:

panic: SQL parser error: table "mo_view_dependencies" does not exist
main.startCNService.func1
cmd/mo-service/main.go:362

Before each panic, the admission fence locks mo_view_refresh and invokes View metadata revalidation. mo_view_dependencies does not yet exist, so the asynchronous bootstrap-upgrade transaction is cancelled and the error propagates through CN Start to the process panic path.

Expected behavior

An upgrade attempt that stopped before the lifecycle catalog migration completed must converge on the next main startup, or fail without panicking and leave a retryable state. CN admission must not depend on mo_view_dependencies before the cluster migration has created it.

Stability and controls

  • Retry reproducer on main @ 804976d2: 3/3 panics, using three independent copies of the preserved failed-start directory.
  • Normal control: an independent 4.2-dev directory completed the same v4.0.6 chain; the target version row became 4.0.6:42:2, both lifecycle catalog tables existed, and the three task-metadata index definitions existed.
  • Data check on the completed control after current-main restart: historical rows and foreign-key catalog rows remained readable; cascade, SET NULL, and composite-key update semantics were preserved.

Evidence

The three process runs each returned exit code 2 with the stack above. The full latest-main reproduction detail is recorded in the related issue comment: #27967 (comment)

Code analysis

pkg/cnservice/server.go starts BootstrapUpgrade as an asynchronous stopper task. Before that task completes, waitForViewMetadataAdmission can enter fenceViewMetadataCatalog, which calls compile.RequireViewMetadataRevalidation. That revalidation accesses mo_view_dependencies; with the v4.0.6 catalog closure still incomplete, the error returns from CN Start and reaches the panic wrapper in cmd/mo-service/main.go.

Regression coverage

Add a process/embedded-upgrade regression that persists a pre-lifecycle failed-start state, restarts main, and verifies retry convergence for none/only-dependencies/only-refresh/both lifecycle-table states. This is lifecycle/process coverage, not a big-data or chaos case.

Related

Activity

  1. added this to the MO-202609 milestone on Sep 2, 2026
  2. added
    kind/bug
    on Sep 2, 2026
  3. added theissue type on Sep 2, 2026
  4. Ariznawlll commented on Sep 2, 2026

    @Ariznawlll
    CollaboratorAuthor

    Additional topology evidence on 804976d2ed85c15790b710db1141e06066284327:

    • I initialized an isolated 4.2-dev cluster with one LogService, one TN, and two CNs. Both CNs completed startup before the version switch.
    • Starting the same data directory with the current main binary caused each CN to reach the View metadata admission fence before the asynchronous upgrade could create the two v4.0.6 catalog tables. The second CN reached the path first; the first CN reached it about one second later.
    • Both paths issued the lifecycle-gate lookup, then failed because mo_catalog.mo_view_dependencies was absent. The process terminated from the CN startup wrapper with the same panic recorded in the issue.

    This shows the failure is not specific to a single-CN topology. More CNs do not serialize the catalog closure ahead of admission; they independently encounter the pre-upgrade fence. The regression test should therefore exercise the real startup ordering with at least two CNs and a 4.2 catalog lacking both lifecycle tables, and assert that the catalog closure finishes before either CN becomes admitted.

  5. Ariznawlll commented on Sep 2, 2026

    @Ariznawlll
    CollaboratorAuthor

    最新 main 复验补充:

    • commit:f4214a008c29c1aa9ca3a0ec84138296dde61358
    • 基线:4.2-dev,1 Log + 1 TN + 1 CN;数据目录来自一次已中断的前向升级,mo_view_dependencies 与 mo_view_refresh 均尚未创建。
    • 将该目录制作成 3 份独立 CoW 副本后,分别使用新 SHA 构建启动。3/3 均在约 8 秒内以退出码 2 结束,并出现同一 panic:SQL parser error: table "mo_view_dependencies" does not exist,调用栈入口为 main.startCNService.func1。
    • 对比此前已验证的 SHA 804976d2ed85c15790b710db1141e06066284327,pkg/cnservice、pkg/hakeeper、pkg/logservice、pkg/bootstrap 以及 pkg/sql/compile/view_metadata_recovery.go 在两者之间无差异。

    因此该问题在当前最新 main 仍可稳定复现;问题范围仍是“中断后的升级重试未收敛”,不是新的多 CN 独立问题。

  6. Ariznawlll commented on Sep 2, 2026

    @Ariznawlll
    CollaboratorAuthor

    已将该 issue 的中断后重试 3/3 复现、双 CN 拓扑证据和回归范围完整同步至 #27967。该现象属于 #27967 的同一 4.2-dev → main catalog 升级时序问题,后续请在 #27967 统一跟踪。

  7. XuPeng-SH commented on Sep 27, 2026

    @XuPeng-SH
    Contributor

    QA follow-up on current main 9c6fcb5b501d040ab1bcb5ada139939770468638.

    A second retry shape in the same upgrade-recovery family was observed: after a bootstrap attempt is interrupted before mo_catalog.mo_view_refresh is created, restarting main logs mo already bootstrapped, then repeatedly queries mo_tables for mo_view_refresh and receives no such table mo_catalog.mo_view_refresh. The CN remains listening but SQL handshakes time out and shutdown stays in cn drain; no panic was observed in this run.

    Evidence retained locally:

    • /home/xupeng/mo-validation/main-qa/logs/matrix-followup-service.log
    • preserved data directory /home/xupeng/mo-validation/main-qa/mo-data-reuse-hang-20260927T014303Z

    Control: a fresh directory on the same binary creates mo_view_refresh during bootstrap and remains SQL-ready while the vector/fulltext extension matrix runs (12 rounds, 11 scenarios each, all pass). This looks like the interrupted bootstrap retry-convergence boundary already covered by this issue/#27967, rather than a new independent query defect. The missing-table/no-panic variant may be useful for the retry matrix.

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

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions