Skip to content

[Bug]: retrying interrupted 4.2→main upgrade stalls on missing mo_view_refresh #29396

Closed

Description

@XuPeng-SH

Summary

After an interrupted in-place upgrade from 4.2-dev to current main, restarting with the same data directory can leave the CN SQL endpoint listening but not usable. The startup admission check repeatedly queries for mo_catalog.mo_view_refresh, gets no such table, and client handshakes time out. Recreating the data directory avoids the symptom.

This is a distinct observed failure mode from the missing-mo_view_dependencies startup panic described in #28004 and tracked with the broader upgrade failure in #27967. A common root cause is possible but has not been established; this issue records the missing-mo_view_refresh retry/stall case so it can be reproduced and checked independently.

Environment

  • MatrixOne current main: 9c6fcb5b501d040ab1bcb5ada139939770468638
  • Linux, one LOG + one TN + one CN
  • Existing 4.2-dev data directory, reused in place for the upgrade

Reproduction

  1. Start a 4.2-dev cluster with one LOG, one TN, and one CN. Wait until SQL is ready, then stop the cluster.
  2. Keep the same data directory and start the cluster with a current-main binary. Do not initialize or replace the directory.
  3. Interrupt this main startup while the v4.0.6 cluster-catalog upgrade is incomplete. To target the observed window, watch the CN log and terminate the bootstrap/CN process immediately after the first no such table mo_catalog.mo_view_refresh error and before the corresponding create cluster table mo_catalog.mo_view_refresh / successful-bootstrap log. Preserve the directory as-is.
  4. Start current main again with the same configuration and exact same data directory.
  5. Attempt a SQL connection to the configured CN port (for example, mysql --connect-timeout=10 -h127.0.0.1 -P6001 -u<user> -p<password> -e 'select 1').

The interruption is important: the symptom is on retrying the partially upgraded directory, not on a clean bootstrap. In the captured run, the upgrade had started but had not created mo_view_refresh; preserving that directory and starting main again reproduced the retry loop. The retained data directory is about 1.6 GB, so a fixture or failpoint would make this reproduction easier to run deterministically.

Actual result

The retry log reports mo already bootstrapped, then start bootstrap upgrade and an upgrade target of 4.0.8. The CN starts listening on port 6001, but the view-metadata admission check repeatedly executes a query against mo_catalog.mo_tables for mo_view_refresh and logs:

no such table mo_catalog.mo_view_refresh

The SQL client handshake times out, and restarting with the same directory repeats the failure. No CN panic was observed in this run.

Expected result

Retrying the upgrade should converge idempotently: create/repair the required cluster catalog tables and admit SQL connections, or fail startup visibly instead of leaving a listening endpoint whose SQL handshakes time out.

Control and evidence

A fresh data directory on the same main binary created mo_catalog.mo_view_refresh, logged successful bootstrap, and became SQL-ready. The retry behavior was captured on the preserved interrupted-upgrade directory in two startup logs. The relevant log excerpts and data directory are retained in the QA environment; the service logs show mo already bootstrapped, start bootstrap upgrade, then repeated missing-table errors.

Activity

  1. added
    kind/bug
    on Sep 27, 2026
  2. added
    severity/s0
    and removed on Sep 27, 2026
  3. added a commit that references this issue on Sep 28, 2026
    3fe37b3
  4. assigned and unassigned on Sep 28, 2026
  5. slyunnn commented on Sep 29, 2026

    @slyunnn

    Regression and extended verification for #29396 (2026-09-29)

    Verification Environment

    • Verified source: origin/main at d8152cb08d7e73316034c33aaf0e7bc01c176f91 — docs: approve the on-demand View metadata contract (#29456).
    • Runtime evidence: the running MatrixOne binary reported branch main and commit d8152cb08d; services were restarted from that image before validation.
    • Full topology health-checked: 2 CN / 1 TN / 1 Log service / Proxy. The MySQL text protocol was used through Proxy 6001, CN1 16001, and CN2 16002; each endpoint was reachable and observed both view-metadata catalog tables.
    • Original-scenario topology: an isolated 1 Log / 1 TN / 1 CN cluster with a fresh data directory initialized by historical 4.2-dev source 1a44f3db3056e32975fde86ca0ab69a094996a3f, then retried with the actual d8152cb08d main image on a dedicated local port. The historical source had no mo_view_* catalog tables before the upgrade.
    • Related production fix: 3fe37b311df718eb7b369513cd6d615b10b04092 — fix(cnservice): preserve bootstrap ownership through admission handoff (#29450). It is contained in the verified main commit. Related test-only PR test(bootstrap): cover interrupted view metadata upgrade recovery #29435 was closed without merge and was not treated as main coverage.

    What Was Covered

    • OK Original interrupted-upgrade path: initialized old-version data, created a user table, and started current main under GDB. The v4.0.8 recovery handler reached entry 1 and was terminated immediately before entry 2, the mo_view_refresh creation operation. This is the compatibility repair path because 4.2 already records v4.0.6 while lacking these tables.
    • OK Retry after interruption: restarted the same retained data with the actual d8152cb08d main image. mo_catalog.mo_view_dependencies and mo_catalog.mo_view_refresh both existed; the preserved old user row and SELECT 1 succeeded. CN logs contained no no such table, panic, or fatal match during the retry window.
    • OK Happy path: a separate normal 4.2-dev to main upgrade completed with both catalog tables present and preserved user data readable.
    • OK Unhappy-path admission behavior: TestCNViewMetadataAdmissionCancelledOwnerCannotPublishIngress passed under -race -count=100; a cancelled bootstrap owner cannot publish ingress while completion is unresolved.
    • OK Boundary behavior: TestCNViewMetadataAdmissionOwnerAfterCatalogCommit and TestCNViewMetadataAdmissionDiscoveryRemainsBounded passed under -race -count=100, covering catalog visibility after commit and the bounded discovery deadline.
    • OK Compatibility / endpoint control: Proxy 6001, CN1 16001, and CN2 16002 each returned 2 matching entries for mo_view_dependencies and mo_view_refresh via the MySQL text protocol.
    • Not covered Original retained QA data volume of about 1.6 GB, multi-CN interruption during upgrade, and client protocols other than the MySQL text protocol. The isolated reproduction used the minimum stable old-version data needed to exercise the persisted upgrade state.

    Findings

    The issue is fixed in main. The controlled interruption before mo_view_refresh left a retryable persisted upgrade state, and the next start with the verified main binary converged the catalog and admitted SQL successfully. The #29450 ownership handoff fix prevents a cancelled or expired bootstrap owner from publishing ingress while catalog repair is still resolving.

    Large-data regression is not required. The defect is a bootstrap/admission and catalog-state recovery path; its relevant boundary is the interrupted metadata operation, not row count, block/batch boundaries, spill, skew, network transfer volume, or concurrency scale. Increasing data volume would add unrelated CI cost without increasing coverage of that state transition.

    MOTR / BVT Coverage

    No MOTR change, branch, recording, replay, or commit was needed. Existing current-main core coverage directly exercises the affected behavior:

    • pkg/tests/upgrade/TestV406UpgradeCreatesViewMetadataCatalogTables passed, including missing-table combinations, injected mo_view_refresh failure, rollback, and retry.
    • pkg/cnservice/TestCNViewMetadataAdmissionOwnerAfterCatalogCommit, TestCNViewMetadataAdmissionDiscoveryRemainsBounded, and TestCNViewMetadataAdmissionCancelledOwnerCannotPublishIngress passed; each was also run with -race -count=100.

    Final Conclusion

    Fixed. The original cross-version interrupted-upgrade state was reproduced in an isolated real runtime, retried using the verified latest main binary, and converged without the reported catalog error or stalled client admission. No large-data regression is needed for the reasons above.

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

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions