Skip to content

[Bug]: Consolidate catalog upgrade to 4.0.7 for 4.1 and 4.2 #31490

Done

Description

@XuPeng-SH

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main (upgrade from released 4.1 and 4.2 deployments)

Commit ID

Target examined: 7e0c9d94fce444a2930c335135a3fc5860e1fe6a; 4.2-dev examined: 86a45d39df3d1f23490fcdd7328b46c5520efada.

Other Environment Information

  • Local reproduction: macOS arm64, single CN, stopped upgrade from MatrixOne v4.2.6.
  • Source catalog: 4.0.6, offset 5.

Actual Behavior

main's catalog upgrade handlers have grown through 4.0.17 while 4.2-dev's latest handler is 4.0.6. Some migrations were subsequently appended to main's 4.0.6 handler. A cluster already at 4.0.6 does not execute that handler when upgrading to a later version, so these effects can be skipped even when the upgrade reports completion.

In the local v4.2.6 to main reproduction, upgrade reached 4.0.17 and existing rows, FK enforcement, an existing SQL function, historical snapshot reads and account snapshot restore worked. However, mo_catalog.mo_user_defined_function lacked arg_types; creating a new SQL function failed with column arg_types does not exist. mo_catalog.mo_foreign_keys also lacked referenced_index_name; the full functional impact of that missing column is not yet established.

Expected Behavior

Consolidate main's catalog upgrade relative to the published 4.1/4.2 boundary so that the final catalog version is 4.0.7, greater than 4.2-dev's 4.0.6. A stopped 4.1 or 4.2 deployment must reach the complete current catalog and preserve its user data, metadata, snapshots and behavior. New installations must initialize consistently with upgraded installations.

Audit every required effect added after the released catalog state, including changes appended to already-consumed handlers and the intermediate 4.0.7–4.0.17 handlers. Incorporate necessary cluster and tenant migrations, backfills and current view definitions in dependency order; eliminate superseded intermediate handlers and redundant migration paths. Keep published version identities and retry/recovery ownership coherent. Avoid adding special cases for this reproduction.

Scope: stopped upgrades from 4.1 and 4.2. Direct 3.x upgrades and clusters that ran unpublished main intermediate catalogs are out of scope. Existing older snapshots may nevertheless be present: when snapshot ownership cannot be established reliably, stop and request administrator confirmation by snapshot UUID instead of guessing.

Steps to Reproduce

  1. Start released v4.2.6 on a clean data directory; create a database with indexed parent/child tables and a foreign key, a SQL function, and account snapshots. Verify rows, the function, and snapshot contents.
  2. Stop all services and retain a copy of the 4.2.6 data directory.
  3. Start main at the target commit on the same data and wait for catalog upgrade to finish.
  4. Inspect mo_catalog.mo_user_defined_function and mo_catalog.mo_foreign_keys via information_schema.columns. Create another SQL function.
  5. Observe the recorded 4.0.17 ready state but missing columns and the SQL function creation error above.

Additional information

Acceptance criteria:

  • Verify real 4.1 and 4.2.6 stopped upgrades to the consolidated 4.0.7 on current main; also compare fresh initialization with upgraded catalog schema.
  • Verify both existing and newly created functions, FK metadata and enforcement, indexes, tenant and cluster catalogs, views, CDC metadata and user data.
  • Verify existing user and branch snapshots, historical reads and account restore; ambiguous inherited snapshot ownership must follow explicit UUID-based administrator confirmation.
  • Exercise restart/retry after interrupted migration and representative failure paths, including tenant/cluster progress, without silently skipping work or exposing an incomplete catalog.
  • Cover large catalogs and resource bounds, relevant concurrency and multi-CN behavior, and avoid regressions in normal startup; include meaningful targeted tests and document operational constraints.
  • Ensure clean migration ownership and ordering. Do not retain 4.0.8–4.0.17 solely as compatibility paths for unpublished intermediate main versions.

The local WIP 6818c728ae1e is unreviewed and not pushed; it is not evidence that the fix is complete.

Activity

  1. added
    kind/bug
    on Oct 27, 2026
  2. added a commit that references this issue on Oct 28, 2026
    ea47345
  3. XuPeng-SH commented on Oct 28, 2026

    @XuPeng-SH
    ContributorAuthor

    QA status for merged main 23488e1eb2c50f4d3638dee1d50715bbc1eb1f67 (#31497): this environment has not run a current-head service or the catalog upgrade tests. Resource headroom under the existing guard is insufficient for a safe large link and isolated upgrade deployment. The PR's reported stopped 4.1/4.2 upgrade and restart runs are author evidence, not tests performed here.

    Fresh initialization, stopped old-version data upgrade, interruption/retry, historical snapshot/PITR behavior and multi-tenant same-directory recovery remain unverified locally. Current-format data must not be handed back to the old binary; preserve the pre-upgrade backup for any rollback. Handing off to QA for acceptance.

  4. Ariznawlll commented on Oct 28, 2026

    @Ariznawlll
    Collaborator

    结论

    测试不通过。实际停止升级和原始缺列场景已通过,但 4.1.4 升级后的 mo_catalog.mo_indexes 与同一 main 全新初始化的目录仍有可观察的列差异,未满足本 issue 对完整当前目录以及升级前后目录比较的验收要求。当前尚未证明普通索引功能损坏;请研发确认这个差异是否为明确允许的分阶段兼容行为。

    关键证据

    • 修复 PR fix: consolidate safe 4.1 and 4.2 catalog upgrades into 4.0.7 #31497 已合入,merge commit ea47345ff8db8a2234f029b06bd1cdee0d6fc8bf 在测试时官方 main 9e29011e7313a57962adc00963baa659d1e81e37 祖先链;实测新服务 git_version() 为 9e29011e73。旧服务分别为真实 v4.1.4 tag a185c23b375956afe098320baf8df39000a43936、v4.2.6 tag 71498157cc21f833b8e717f45d50d1f926be3134。环境为 macOS arm64 隔离单 CN/TN/Log;旧版本各构造一套持久化数据并停止,再各复制三份独立执行升级,不等同三套独立部署。旧版构建复用了本机已有 native 库,未声称官方发布镜像验证。
    • 4.1.4 原目录 4.0.1 offset 1、4.2.6 原目录 4.0.6 offset 5;两者升级至 4.0.7 offset 41 均 3/3。原问题涉及的 mo_user_defined_function.arg_types 和 mo_foreign_keys.referenced_index_name 均存在,旧/新 SQL UDF 返回 5/6,父子数据保持;非法外键插入 1452、数据不变;数据库旧快照读到 11、当前读到 12;独立租户账号快照可从当前 200 恢复至 100,分别 3/3。4.1 升级启动阶段曾有锁冲突自动重试,随后三个副本均完成。
    • 比较 information_schema.columns 中 sys 租户 mo_catalog 的表名、列名、类型、nullable、序号:同 SHA 全新初始化 682 列,4.2.6 升级后 682 列且两集合相同;4.1.4 升级后 681 列,唯一差异为全新库存在 mo_indexes.included_columns(text,nullable,ordinal 16),4.1 升级库不存在。三个 4.1 升级副本重启复核均查不到该列,直接执行 SELECT included_columns FROM mo_catalog.mo_indexes LIMIT 1 均报 1054 column included_columns does not exist,3/3。
    • 源码 pkg/bootstrap/versions/v4_0_0/upgrade_test.go 的 TestUpgradeDefersMoIndexesIncludeColumn 提到目录变更需待写入方显式列清单后分阶段发布;这可能解释为什么未迁移,但不足以单独证明上述 4.1 升级差异符合本 issue 的交付契约。
    • 未验证大目录性能、分布式多 CN、人工中断/恢复、CDC 旧任务迁移、branch snapshot、系统级历史快照恢复及完整 CI;本地测试不替代这些场景。4.2 全字段比较只对一个已升级副本执行。

    待解决点

    请 @XuPeng-SH 确认 4.1 升级库缺少 included_columns 是否为有意且受支持的例外、该列的查询及相关功能契约,以及本 issue 的新旧目录一致性验收应如何处理;若要求完整一致,请补充迁移后再复验。中断、规模和多 CN 场景仍待覆盖。

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

Metadata

Metadata

Assignees

Labels

kind/bugneeds-triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions