Skip to content

[Bug]: CDC NoFull may skip changes committed immediately after task creation #28268

Closed

Description

@XuPeng-SH

Summary

A table-level CDC task created with NoFull=true can skip source changes committed immediately after CREATE CDC returns, while the task remains running with no error. The same behavior is reproducible on the current main and on PR #27939; this issue is reported as a pre-existing CDC capture-window gap, not as a regression introduced by #27939.

Environment

  • MatrixOne commit: 9add8e46c19b40a1a6488ba5d2969d0b380e2083 (PR fix(cdc): accelerate bounded initial snapshots #27939 latest head)
  • Control code path: current main has the same NoFull startup watermark initialization
  • Host: MatrixOne test machine 10.222.1.55
  • Deployment: single-process quickstart, MySQL frontend 127.0.0.1:6001

Reproduction

  1. Create matching source and target tables and the required source PITR.

  2. Create a table-level task:

    CREATE CDC life55
      'mysql://sys#root:[email protected]:6001'
      'mysql'
      'mysql://sys#root:[email protected]:6001'
      'bb27939_55.src:bb27939_55.dst'
      {'Level'='table','NoFull'='true','Frequency'='1m'} internal;
  3. Immediately after CREATE CDC returns (within about 1 second), insert 1000 rows using a recursive CTE.

  4. Wait longer than one polling interval (75 seconds in the reproduction).

  5. Query the target and task metadata.

Actual result

  • Target row count remains 0.
  • Task state remains running.
  • err_msg remains empty.
  • The watermark advances/heartbeats, but the 1000 committed rows are not delivered.

The same task synchronizes rows inserted after the pipeline has initialized (the control insert reached the target after the next 1-minute poll), so this is a startup capture window rather than a general replication failure.

Expected result

For NoFull=true (documented as “skip initial snapshot, sync incremental changes only”), changes committed after successful CREATE CDC should not be silently omitted. The implementation should either:

  1. durably define the incremental start watermark as part of task creation and capture all later commits; or
  2. document and expose the actual activation boundary, with a state/acknowledgement that tells clients when writes are safe to rely on.

Root-cause direction

The asynchronous pipeline currently initializes the no-full watermark from txnOp.SnapshotTS() when addExecPipelineForTable starts. If a source commit lands after task creation but before that pipeline snapshot is taken, the commit is older than the newly installed watermark and is skipped.

Related / distinction

Activity

  1. added
    kind/bug
    severity/s0
    on Sep 5, 2026
  2. added a commit that references this issue on Sep 24, 2026
    a61e771
  3. jiangxinmeng1 commented on Oct 21, 2026

    @jiangxinmeng1
    Contributor

    fixed by #28506

  4. Ariznawlll commented on Oct 21, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 分支:官方 main
    • commit:838cc78aa1efe46693876a48c05c202979047b7b
    • 修复:#28506 已 MERGED,merge commit a61e7710e26c7d7613e2aa19913460ff9b7e2606;GitHub compare 证实该提交是上述 main 的祖先(ahead 535 / behind 0)。
    • 部署:隔离的本地 macOS arm64 服务,1 LogService、1 TN、2 CN(MySQL 前端 46001/46011);另起隔离 MySQL 8.3.0 InnoDB sink(仅 127.0.0.1:46306)。Go 公共生命周期用内嵌 1 CN/TN/LogService 环境。
    • 测试日期:2026-10-21 UTC。

    原问题验证

    在每轮新建源表、目标表及 PITR 后,创建 table-level NoFull=true、Frequency=1m 的 CDC,CREATE CDC 返回后立即一次写入 1000 行(id 2–1001,v=2×id),不等待异步管道启动;建任务前预置 id=1,随后再写入 id=1002 作已启动管道对照。每轮都检查全部 (id,v) 明细、行数、去重数、和值、上下界、任务状态及错误字段,结束时删除 CDC/PITR/库。

    1. MO → MO sink:3/3 轮,立即写入的 1000/1000 行全部到达;COUNT(DISTINCT id)=1000、SUM(v)=1003000、MIN/MAX(id)=2/1001,两个 CN 读到相同的完整行集;预置 id=1 为 0 行。随后 id=1002/v=2004 到达,最终 1001 行,任务保持 running 且 err_msg 为空。
    2. MO → 真正的 MySQL 8.3.0 InnoDB sink:同一 NoFull 时序 3/3 轮,立即写入 1000/1000 行,完整行集及上述计数/和值/边界均正确;预置行未被全量复制,后续 id=1002/v=2004 正常到达,任务保持 running 且错误为空。

    原报告 SQL 把同一个 MO 端口声明为 mysql sink。直接照抄此不匹配的 sink 类型,在当前 main 上会因查询 MySQL 专有 information_schema.INNODB_TABLES 而使任务失败;这不能用来判断 NoFull 捕获窗口。为保持目标后端与类型一致,上述验证分别使用 matrixone→MO 和 mysql→真实 MySQL sink;除 sink 配置修正外,保留了报告的 table-level/NoFull/Frequency/立即 1000 行时序。没有声称原报告这条类型不匹配的字面 SQL 通过。

    Happy Path 覆盖

    1. 创建任务后立即提交的数据 6/6 轮无丢失、无重复、值正确;管道启动后的对照增量 6/6 轮到达。
    2. MO sink 两 CN 读一致;MySQL sink 使用真正 InnoDB 目标;每轮任务、PITR 和测试库均清理。

    Unhappy Path 覆盖

    1. 建任务前已有行 6/6 轮没有被 NoFull 错误地复制;目标行集没有额外行或错值。
    2. 字面 mysql sink→MO 的不匹配配置导致目标元数据查询失败,未将其算作修复失败或成功;Go 回归还覆盖旧协议缺少无损起点时拒绝、过期读取不推进持久起点和任务重启/跨 CN 接管边界。

    白盒验证

    • pkg/tests/sqlintegration 的 TestCDCNoFullPublicLifecycle:-count=3 PASS,覆盖公共 SQL 创建、立即写入、持久起点及 CN 关闭/重启。
    • TestCDCNoFullPublicTakeoverLifecycle:-count=3 PASS,覆盖跨 CN claim/takeover。
    • pkg/cdc 中 lossless start、协议边界、NoFull admission 生命周期、stale read 和 watermark tuple 定向测试:-count=3 PASS。

    回归测试

    现有主仓 Go 公共 SQL 生命周期和跨 CN 接管回归直接覆盖原始时序及内部持久化边界;按当前 QA 约定不重复新增较难稳定控制异步 admission 时点的 MOTR 用例。未运行完整 MOTR suite,也未新触发共享/昂贵 CI。修复 PR 当时的多 CN Compose、SCA、覆盖率等检查通过,但历史 TKE BVT、Ubuntu UT 与 CI Required 为 FAILURE;本次独立验收不将这些历史失败记为通过,也不声称已完成 TKE 集成验收。

    测试证据

    测试结论

    测试通过。

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