Repository navigation
Description
Summary
After upgrading the MatrixOne binary (e.g. rolling image update via Operator / MO Cloud gitops) without completing the metadata upgrade step, queries or features that depend on mo_catalog.mo_branch_metadata fail with table does not exist.
This is observed when auto-upgrade = false (MO Cloud default) and UPGRADE ACCOUNT ALL has not been executed after the image rollout.
Environment
- Deployment: MO Cloud / Kubernetes + MatrixOne Operator (distributed cluster)
- CN config:
auto-upgrade = false(explicit in gitops / COS managed CN config) - Upgrade path: Binary/image upgraded (
spec.version/mo-image-tagchanged), schema upgrade step skipped or incomplete - Affected version span: At least MO 4.0.0+, where
mo_branch_metadatais introduced via the bootstrap upgrade framework (v4_0_0/cluster_upgrade_list.go)
Steps to Reproduce
- Deploy MatrixOne at a version before
mo_branch_metadatawas introduced (or any version where the table is absent). - Set CN config:
[cn] auto-upgrade = false
- Upgrade MO binary only (e.g. update
spec.version/mo-image-tagand roll CN pods) without running:UPGRADE ACCOUNT ALL;
- Connect as a tenant and use a feature that touches branch metadata (e.g.
DATA BRANCH, snapshot/branch quota checks, or internal SQL referencingmo_catalog.mo_branch_metadata).
Expected Behavior
After a version upgrade, cluster-level catalog tables required by the new binary — including mo_catalog.mo_branch_metadata — should exist, and branch/snapshot-related features should work.
Either:
UPGRADE ACCOUNT ALLis run as part of the controlled release (MO Cloud default release flow), orauto-upgrade = truetriggersBootstrapUpgrade()on CN startup to apply cluster + tenant metadata migrations automatically.
Actual Behavior
mo_catalog.mo_branch_metadata is missing. Operations fail, for example:
table mo_catalog.mo_branch_metadata does not exist
(or equivalent doesn't exist / internal error when the engine expects the table).
Other v4.0.0 cluster-level objects may also be missing if the upgrade framework never ran, e.g. mo_feature_registry, mo_feature_limit, mo_ccpr_*, etc.
Root Cause (Analysis)
MatrixOne separates binary upgrade from metadata/schema upgrade:
| Layer | Mechanism | What it does |
|---|---|---|
| Binary | spec.version, Operator rolling update |
Replaces MO image (Log / TN / CN) |
| Metadata | UPGRADE ACCOUNT ALL or auto-upgrade=true |
Runs bootstrap upgrade framework: cluster tables + per-tenant catalog migrations |
With MO Cloud defaults:
auto-upgrade = false→ CN does not callBootstrapUpgrade()on startup.mo_branch_metadatais created in cluster-level upgrade entryupg_create_mo_branch_metadata(v4.0.0cluster_upgrade_list.go).- Without
UPGRADE ACCOUNT ALL,mo_catalog.mo_version/mo_catalog.mo_upgradestay at the old state andmo_branch_metadatais never created. - Lazy per-tenant upgrade on login (
MaybeUpgradeTenant) is not wired into the connection path, so connecting alone does not repair missing cluster tables.
Workaround
Run as sys tenant after image upgrade completes:
UPGRADE ACCOUNT ALL;Verify:
-- cluster version
SELECT * FROM mo_catalog.mo_version ORDER BY create_at DESC;
-- upgrade progress
SELECT id, from_version, to_version, final_version, state,
total_tenant, ready_tenant
FROM mo_catalog.mo_upgrade
ORDER BY id DESC;
-- table exists
SHOW TABLES FROM mo_catalog LIKE 'mo_branch_metadata';Suggested Improvements
- Fail fast: If CN binary version ≥ 4.0.0 and
mo_branch_metadatais missing, return a clear error at startup or first use: "cluster metadata not upgraded; run UPGRADE ACCOUNT ALL". - Observability: Expose upgrade/schema drift in
SHOW ACCOUNT UPGRADEor metrics (cluster version vs binary version). - Documentation: Call out in upgrade docs that
auto-upgrade=false+ image-only rollout requiresUPGRADE ACCOUNT ALLbefore branch/snapshot features are usable. - (Optional) Consider creating critical cluster-level tables during bootstrap when binary is new but
mo_versionis old, even withauto-upgrade=false, or enforce upgrade completion before marking CN Ready.
Related Configuration
[cn] auto-upgrade— defaultfalseon MO Cloud[cn] upgrade-tenant-batch— only relevant whenauto-upgrade=true- COS
spec.upgradeStrategy.upgradeSchema: true— triggers schema phase after component rollout - Manual:
UPGRADE ACCOUNT ALL/UPGRADE ACCOUNT <name> [RETRY n]
Activity
[-]Table mo_catalog.mo_branch_metadatadoes not exist after upgrade[/-][+]Table mo_catalog.mo_branch_metadata does not exist after upgrade[/+]Ariznawlll commentedon Jun 30, 2026
验证了一轮升级路径,结论如下。
测试 run: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/28425398530
测试 workflow:
MO Kernel Upgrade Test On TKE测试分支/提交:
matrixorigin/mo-nightly-regression@fix/kernel-upgrade-path-workflow-main/86c1c610fdaa58dbff80121423614146e3f82026测试结果:整体
success本轮覆盖的是
3.0.2 -> 3.0.3升级路径,重点验证升级后mo_catalog.mo_branch_metadata是否存在、可读,以及真实DATA BRANCH/SNAPSHOTSQL 是否能写入对应 metadata。1. 构建 base 镜像
Job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/28425398530/job/84227283285
证据:base commit checkout + image push 成功。
2. 构建 target 镜像
Job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/28425398530/job/84227283337
证据:target commit checkout + image push 成功。
3. 创建 base 集群
Job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/28425398530/job/84229614669
证据:namespace/secret 创建成功,base 集群 9 个组件最终 Running。
4. 升级前准备数据和租户
Job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/28425398530/job/84234551525
证据:base 版本为
b0544ba,创建系统库测试表和 3 个租户,每个租户都有升级前数据。5. 执行集群镜像升级
Job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/28425398530/job/84234626556
升级参数:
证据 1:第一阶段
cn-first,DN 保持 base,Log/CN/Proxy 升到 target。证据 2:第二阶段 DN 也升级到 target,最终所有组件均为 target 镜像。
6. 执行 schema/tenant metadata upgrade
Job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/28425398530/job/84237702345
证据:
AUTO_UPGRADE=false场景下手动执行upgrade account all;成功。7. 校验升级结果、元数据表和数据
Job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/28425398530/job/84237775758
证据 1:当前运行版本已经是 target commit。
证据 2:升级前写入的数据仍可读。
证据 3:metadata upgrade 状态完成。
证据 4:本 issue 关注的
mo_branch_metadata存在、可读,并通过真实DATA BRANCH/SNAPSHOT冒烟验证。结论
本轮
3.0.2 -> 3.0.3升级路径验证通过:cn-first升级过程中,Log/CN/Proxy 先到 target,随后 DN 到 target。AUTO_UPGRADE=false场景下手动upgrade account all;成功。mo_version/mo_upgrade/mo_upgrade_tenant状态均完成。mo_catalog.mo_branch_metadata已验证存在、可读,并通过真实DATA BRANCH/SNAPSHOTSQL 冒烟验证。注意:本轮 target metadata version 是
3.0.3,因此主要验证mo_branch_metadata。mo_feature_registry/mo_feature_limit属于 4.0+ 目标版本路径,需要另起 4.0 target 的升级 run 覆盖。Ariznawlll commentedon Jul 6, 2026
测试通过
[4.2.1-hotfix] fix catalog upgrades blocked by lineage checks (#32701)