Skip to content

[Bug]: Fresh v4.2.5 to main upgrade blocks SQL login on missing CDC owner_generation prerequisite #30215

Closed

Description

@XuPeng-SH

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Searches for owner_generation upgrade, pending_source_table_id upgrade, and mo_cdc_watermark 4.2.5 in this repository returned no matching issues on 2026-10-14.

Branch Name

main, upgrading an official v4.2.5 store

Commit ID

Target actually built and executed: b1a6da4e16d87d64ab922b3acb537cd851b3f5c3.
Source official release: 1a44f3db3056e32975fde86ca0ab69a094996a3f (v4.2.5).

Other Environment Information

  • Ubuntu 24.04.3 LTS, Linux x86_64; local single-process mo-service -launch with one LogService, TN, and CN.
  • Container memory limit 8 GiB, CPU quota 8 cores; server GOMAXPROCS=4, GOMEMLIMIT=6GiB.
  • Official release archive SHA256: a0e0aad81a914d6cd7081f68bbfb7695cba20544ca4c8f37358f4005067b8da1.
  • Official release executable SHA256: 5d136df6fab5e7a5bdf4ba3e678470d898c8d681f3fdae99095ecd9c4205d2ed.
  • Target executable SHA256: 6f7170a28a706a38d415b1bc49d1721b540a35634d94c8e62a24945ac220e7a4; built using the official build-with-prebuilt-native target. Production source files were not modified.
  • Each repetition starts with a new, nonexistent data directory under the official release. No CDC task, fault injection, column alteration, or downgrade is involved.

Actual Behavior

A freshly initialized official v4.2.5 database with one user table and one row cannot become SQL-ready after a clean stop and one-way upgrade to the tested main. The main catalog upgrade repeatedly executes:

alter table mo_catalog.mo_cdc_watermark
add column pending_source_table_id bigint unsigned null after owner_generation;

It fails with Unknown column 'owner_generation' in 'Columns Set'. Authentication remains blocked by tenant-upgrade checks, and clients receive read timeouts instead of completing SELECT VERSION(), git_version() or reading the persisted row.

Two independent fresh-store repetitions reproduced this on main b1a6da4:

Repetition Release SQL ready Release clean exit Main observation Authenticated SQL ready Missing-column errors
0 15.235 s 0 77.235 s No 27
1 16.195 s 0 76.331 s No 27

The target processes were stopped by the harness with SIGINT after the bounded failed-readiness observation; their eventual exit code 0 is not upgrade success. Observations do not establish an infinite hang.

Before upgrade, actual v4.2.5 SQL returned 8.0.30-MatrixOne-v4.2.5, git version 1a44f3d, catalog version 4.0.6, offset 5, state 2. Its mo_cdc_watermark columns were:

account_id, task_id, db_name, table_name, watermark, err_msg, __mo_cpkey_col

Neither source_table_id nor owner_generation exists. The single business row (1,42) was verified before the release clean stop.

Expected Behavior

A supported forward upgrade should apply every catalog prerequisite required by later migration entries, finish authentication, and preserve the row. No manual CDC catalog surgery should be needed for a fresh official release database that has never used CDC.

Steps to Reproduce

  1. Obtain the official mo-v4.2.5-linux-x86_64 package and initialize a fresh directory using local LogService/TN/CN launch configuration. Ensure all data, WAL, raft, and object-store paths point into this new directory; do not reuse any main-opened store. Launch the official release executable:

    /path/to/mo-v4.2.5-linux-x86_64/mo-service -launch /absolute/path/to/launch.toml
  2. Wait for SQL login, then execute:

    SELECT VERSION(), git_version();
    CREATE DATABASE upgrade_min;
    CREATE TABLE upgrade_min.t(id BIGINT PRIMARY KEY, n INT);
    INSERT INTO upgrade_min.t VALUES (1,42);
    SELECT * FROM upgrade_min.t;
    SHOW CREATE TABLE mo_catalog.mo_cdc_watermark;
    SELECT * FROM mo_catalog.mo_version;
  3. Send SIGINT to this release process and wait for exit 0. Keep the complete store and launch configuration. No release process may still be using it.

  4. Build main at the target SHA above and launch that executable using the same configuration and store, with its matching native libraries. This is the first main opening of the directory.

  5. Attempt SQL login and the version/row checks for at least 75 seconds. Observe the missing-column migration errors and authentication timeouts in main-server.log. Stop main after recording the failure. Do not open this now main-owned directory with v4.2.5.

  6. Repeat from step 1 in a second completely fresh directory. Both executions above followed this procedure.

Additional information

Actual target log excerpt:

execute upgrade entry sql error
error: Unknown column 'owner_generation' in 'Columns Set'
UpgradeEntry type:0 schema: mo_catalog.mo_cdc_watermark,
upgrade sql: alter table mo_catalog.mo_cdc_watermark add column pending_source_table_id bigint unsigned null after owner_generation
failed to handle version upgrade: 4th: 4.0.10 -> 4.0.11, state 0, final 4.0.14
authenticate user failed: context deadline exceeded
internal error: checkTenantUpgrade

Source localization, not a proven complete root cause: pkg/bootstrap/versions/v4_0_6/cluster_upgrade_list.go registers the prerequisite source_table_id and owner_generation additions; pkg/bootstrap/versions/v4_0_11/cluster_upgrade_list.go adds pending_source_table_id AFTER owner_generation. The tested release catalog is missing both prerequisites, while main demonstrably reaches the later entry. The version/protocol selection that skips those prerequisites still needs investigation.

A larger healthy release store also failed upgrading to earlier main a33dcfb2e54196e17abe21de4346200a18009d83 with this same specific missing-column error, but the fresh one-row b1a6da4 reproductions are the primary evidence. Separate historical recovery failures with LogService/TN readiness timeouts are not being attributed to this CDC migration error.

Full reproducer minimal_upgrade.py, both configurations, build provenance, SQL receipts, server logs, and post-main stores are preserved in the campaign evidence. Both fresh stores are permanently marked main-owned, including these failed starts; no main-to-release execution was performed.

Activity

  1. added
    kind/bug
    on Oct 14, 2026
  2. XuPeng-SH commented on Oct 15, 2026

    @XuPeng-SH
    ContributorAuthor

    Reproduced twice again on latest main 17a6200f59e764729e5544908fffd5480ae88279 on 2026-10-15 (Asia/Shanghai). The opening and closing GitHub main tip matched this SHA. Actual target binary SHA256: 778bf2982bd0e5a7637d8dddfb2d2e60d5dfd82d09154d11a1d95dfb9147e9f0; unchanged production sources, same verified binary also SQL-version-checked in separate healthy main fixtures.

    Each independent minimal fixture was first initialized by official v4.2.5 (1a44f3d), containing only upgrade_min.t(1,42). Both then passed an actual same-v4.2.5 normal restart and row verification before upgrading:

    • repetition 0: release restart SQL-ready 5.017846 s, row verified, clean exit 0;
    • repetition 1: release restart SQL-ready 5.053018 s, row verified, clean exit 0.

    For each, the complete stopped release source was hash-verified and copied into a separate, permanently main-owned target. No original release store was opened by main; no target was opened by release afterward. The downgrade guard was checked without launching a release process. Source manifests stayed unchanged.

    Both main targets failed authenticated SQL readiness, with 36 occurrences each of:

    Unknown column 'owner_generation' in 'Columns Set'
    alter table mo_catalog.mo_cdc_watermark add column pending_source_table_id bigint unsigned null after owner_generation
    

    Actual bounded observations were 92.106381 s and 91.093306 s (the 90 s deadline includes a bounded connection-attempt overshoot). Both were then stopped by the harness with SIGINT and exit 0; that is cleanup, not successful upgrade.

    Before upgrade, both release catalogs reported version 4.0.6, offset 5, state 2; mo_cdc_watermark had neither source_table_id nor owner_generation. There was no CDC task, fault injection, manual catalog alteration, or downgrade. This confirms the same prerequisite-column upgrade failure on current tested main, but does not add a proven explanation of why prerequisite migration selection is skipped. Exact configurations, byte manifests, SQL receipts and both post-main stores are retained in the campaign evidence.

  3. XuPeng-SH commented on Oct 15, 2026

    @XuPeng-SH
    ContributorAuthor

    Further localization of the skipped prerequisites on main 17a6200f59e764729e5544908fffd5480ae88279:

    This is analysis of the two real clean-release forward-upgrade executions in the preceding comment, not two additional SQL executions or a patched-build validation.

    The actual selected route is now extracted from both server logs:
    4.0.6 -> 4.0.7 -> 4.0.8 -> 4.0.9 -> 4.0.10 -> 4.0.11 -> ... -> 4.0.14.
    Both log the starting catalog as 4.0.6, offset 5. The route contains no same-version 4.0.6 -> 4.0.6 step. Neither log contains execution of the ADD COLUMN source_table_id or ADD COLUMN owner_generation prerequisite SQL. Each contains 12 execute upgrade entry sql error events for the later missing-owner failure (36 matching missing-column log occurrences when all reporting layers are counted).

    The source explains this selection:

    1. service_upgrade.go loads the latest ready version string and queues only handlers with Compare(v.Metadata().Version, from) > 0 when constructing the route to a newer final version. An already-ready 4.0.6 release therefore starts with the 4.0.7 handler, even though main has appended more entries to its 4.0.6 handler.
    2. v4_0_6/cluster_upgrade_list.go registers addCdcWatermarkSourceTableID and addCdcWatermarkOwnerGeneration only in that skipped handler. Their protocol-48 gate cannot help a step that was not queued.
    3. v4_0_11/cluster_upgrade_list.go then adds pending_source_table_id ... AFTER owner_generation, exactly where both actual runs fail.

    This localizes the standard-route prerequisite omission; it is not evidence that a proposed fix has been tested. The existing v4_0_7/upgrade.go comment already documents the same strict-newer-handler constraint for another migration. A repair should put the idempotent prerequisites in a reachable newer migration path while preserving mixed-version writer/protocol safety. Rewinding mo_version, downgrading main-opened storage, or asking users to edit CDC catalog columns is not a validated workaround.

    No production source, catalog, or preserved database bytes were modified for this analysis. The separate historical LogService recovery/EOF findings remain unrelated.

  4. Ariznawlll commented on Oct 26, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 分支:官方 main
    • commit:f4450f23b8d5347678936b81515bdc04b21c6a08;本地二进制 go version -m 的 vcs.revision 与之相同,SHA256 48e8521786124436a569ecd86074b5e65c22b20a10bb1cfdd62f1934a65d30ed,受隔离目录中的未跟踪 QA 文件影响 vcs.modified=true,已核对受跟踪源文件无修改。
    • 修复 PR: #30642 已合入,merge commit e9590abbf4305469233c5bdee8c83eabb72a2124 经补齐浅克隆历史后确认是上述 main SHA 的祖先。
    • 旧版来源:官方 v4.2.5 tag 源码 1a44f3db3056e32975fde86ca0ab69a094996a3f,原生构建;固定的 ONNX 原生依赖经 SHA256 30afadcfc3c704f7671f8430d6252956651c1972373901d2be629da2e6a4d8ee 校验,旧版二进制 SHA256 2d2aae938d072b1586b17bc1bf681b58943036d71e98ddd36237ef4f240f1574。
    • 部署方式:隔离的 Darwin/arm64 单进程 mo-service -launch,1 LogService / 1 TN / 1 CN,SQL 端口 48001;每次从未被 main 打开过的旧版种子目录复制完整数据,独立升级,保留各次结果。未使用共享 TKE、128/129 或昂贵 CI。
    • 测试日期:2026-10-26(Asia/Shanghai)。

    原问题验证

    旧版实际目录为 mo_version=('4.0.6',5,2),mo_cdc_watermark 缺少 source_table_id、owner_generation,用户表 qa30215.t 有原行 (1,42)。先在同一旧版完成一次正常重启、重新登录与原行读取,随后干净退出;保留旧版种子不动。将三份独立副本分别交由当前 main 首次打开。3/3 均走完目录迁移并达到 ('4.0.17',1,2),SQL 登录可用;未出现原问题中的 Unknown column 'owner_generation' 阻断。每次服务均正常停止,退出码 0。升级启动阶段目录尚未完成时的短暂 SQL 超时不计作就绪;仅在最终 state=2 后执行验收 SQL。

    Happy Path 覆盖

    1. 旧版正常重启与业务数据读取:原行 (1,42) 保持不变。
    2. 旧版到最新 main 的三份独立升级:3/3 完成登录,目录 4.0.17/offset=1/state=2;历史 4.0.6/offset=5/state=2 保留。
    3. 每份升级后 SHOW COLUMNS FROM mo_catalog.mo_cdc_watermark 均包含 source_table_id、owner_generation、pending_source_table_id、target_identity;原业务行均为 (1,42)。

    Unhappy Path 覆盖

    1. 原始缺失前置列边界:三份旧版数据在升级前均没有 source_table_id 和 owner_generation;当前修复会幂等补齐,不再因 pending_source_table_id AFTER owner_generation 中断。
    2. 失败原子性:每份升级后均执行 BEGIN; UPDATE ... SET v=43;,事务内实读为 43,再 ROLLBACK,事务外实读仍为 (1,42),3/3。未对系统目录手工补列、回退版本号或做降级打开。
    3. 本问题的最小原场景无 CDC 任务、并发 CN 或故障注入;这些维度不作为本次目录前置列修复的验收条件。

    白盒验证

    在同一 main SHA 上执行 go test ./pkg/bootstrap ./pkg/bootstrap/versions/v4_0_11 -run 'TestDoCheckUpgradeRetainsHistoricalCDCWatermarkTarget|TestCDCWatermarkUpgradeAdmission|TestCDCWatermarkColumnsUpgradeMetadata' -count=3,两个包均通过。这里验证历史版本目标保留、缺列迁移的准入及列元数据;不以单元测试代替上述实际跨版本启动。

    回归测试

    测试证据

    • 当前完整 SHA 对应的二进制摘要、go version -m 记录及 git merge-base --is-ancestor 检查结果;三次各自保留的隔离数据目录为 /private/tmp/mo-six-qa-20261026/qa-30215/native/run4-data、run5-data、run6-data,旧版只读种子为同目录 seed-data。
    • 三次实际 SQL 结果一致:catalog_versions=(('4.0.6',5,2),('4.0.17',1,2));CDC 列包括四个新增列;preserved_row=(1,42), transactional_write_rollback=ok。定向 Go 测试两个包均 ok。
    • 环境边界:独立 QA 未在原 Ubuntu/x86_64 容器中重新跑一遍完整跨版本升级,也未执行 PR 中被跳过的 Upgrade Compatibility job;本次实测使用相同官方 tag 源码目录版本与相同 1LOG/1TN/1CN 持久化迁移路径,结果按上述范围报告。

    测试结论

    测试通过。

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