Skip to content

ticdc: document Debezium source.start_ts option - #21896

Open
ekexium wants to merge 1 commit into
pingcap:masterfrom
ekexium:translate/doc/ticdc-debezium-start-ts
Open

ticdc: document Debezium source.start_ts option#21896
ekexium wants to merge 1 commit into
pingcap:masterfrom
ekexium:translate/doc/ticdc-debezium-start-ts

Conversation

@ekexium

@ekexium ekexium commented Aug 26, 2026

Copy link
Copy Markdown
Member

What is changed, added or deleted? (Required)

Document the optional TiCDC Debezium JSON source.start_ts field (new in v8.5.9). Downstream consumers can use the original PD TSO of the source transaction for exact-once or transaction grouping. The option is disabled by default.

  • Add a subsection on the Debezium protocol page covering URI debezium-include-start-ts, TOML [sink.debezium] include-start-ts, URI precedence, DML-only scope, Avro rejection, rollback, and uint64 TSO precision (do not parse as JavaScript Number / float64).
  • Add the URI parameter, changefeed config item, Open API v2 include_start_ts field, and the DML payload.source.start_ts table row.

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions (in Chinese).

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)

What is the related PR or file link(s)?

AI agent involvement

  • The changes in this PR were primarily made by an AI agent on behalf of the PR author.

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Summary by CodeRabbit

  • 新功能

    • 新增配置项,可在 Debezium JSON DML 消息中包含源事务的原始 PD TSO(source.start_ts)。
    • 支持通过配置文件或 URI 参数启用,并以 URI 参数为优先;默认关闭。
    • 该选项仅适用于 MQ/Kafka 的 Debezium JSON 协议,不兼容 Debezium Avro。
  • 文档

    • 补充配置说明、消息示例、兼容性提示及版本信息。

Copilot AI lite review requested due to automatic review settings August 26, 2026 08:36
@ekexium ekexium added area/ticdc Indicates that the Issue or PR belongs to the area of TiCDC. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. translation/from-docs This PR is translated from a PR in pingcap/docs. type/enhancement The issue or PR belongs to an enhancement. labels Aug 26, 2026
@ti-chi-bot

ti-chi-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kissmydb for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 26, 2026
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

文档新增 Debezium JSON DML 消息中 source.start_ts 的配置、参数优先级、协议限制、兼容性说明和字段定义。默认不输出该字段,URI 参数可覆盖配置文件设置。

Changes

Debezium 事务开始 TSO

Layer / File(s) Summary
配置项与 URI 参数
ticdc/ticdc-changefeed-config.md, ticdc/ticdc-open-api-v2.md, ticdc/ticdc-sink-to-kafka.md
新增 include-start-tsinclude_start_tsdebezium-include-start-ts 参数说明。文档说明默认值、URI 参数优先级、适用协议及 Avro 限制。
Debezium 输出字段说明
ticdc/ticdc-debezium.md
补充 source.start_ts 的启用条件、事件范围、回滚兼容性、uint64 PD TSO 精度说明、JSON 示例和字段定义。

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🔵 Low · up to 92bb8

The documentation adds the optional Debezium transaction TSO field, but the Open API reference still needs to clarify where it applies, how URI precedence works, and that Avro rejects the option. The PR is mergeable with explicit owner follow-up on this bounded documentation contract gap.

Suggested reviewers: qiancai, 3aceshowhand

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了本次 PR 的主要变更,即记录 TiCDC Debezium 的 source.start_ts 配置项。标题简洁且明确。
Description check ✅ Passed PR 描述完整说明了变更内容、适用版本、相关链接、AI 参与情况和分支检查项。描述覆盖配置方式、优先级、适用范围及兼容性注意事项。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (4 skipped: 4 unsupported.)

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 为 TiCDC 的 Debezium JSON 输出补充文档:新增/补全 source.start_ts(源事务开始时的原始 PD TSO)相关配置、OpenAPI 字段说明,以及消息字段表格条目,帮助下游消费者实现更精确的事务分组或 exactly-once 处理。

Changes:

  • 在 Debezium 协议文档中新增“包含事务开始 TSO(v8.5.9 引入)”小节,说明开启方式、影响范围与精度注意事项。
  • 在 Kafka sink URI 参数、changefeed 配置项、OpenAPI v2 参数说明中补充 include_start_ts/include-start-ts 及对应 URI 参数。
  • 在 Debezium DML payload 字段表中补充 payload.source.start_ts 行说明。

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
ticdc/ticdc-sink-to-kafka.md 为 Kafka sink URI 参数表新增 debezium-include-start-ts 说明与链接。
ticdc/ticdc-open-api-v2.md 为 OpenAPI v2 的 sink.debezium 参数表新增 include_start_ts 字段说明。
ticdc/ticdc-debezium.md 新增“包含事务开始 TSO”小节,并在 DML 字段表中新增 payload.source.start_ts 说明。
ticdc/ticdc-changefeed-config.md 为 changefeed 配置 sink.debezium 增加 include-start-ts 配置项说明与引用链接。
Suppressed comments (2)

ticdc/ticdc-debezium.md:59

  • 为避免读者将 uint64 误认为普通文本,建议将类型名用反引号标注,并将 “IEEE-754” 按常见写法写为 “IEEE 754”。
> `start_ts` 是原始的 uint64 PD TSO,不是毫秒时间戳。消费者必须将其作为 64 位整数或十进制字符串处理。不要将其解析为 JavaScript `Number` 或 IEEE-754 `float64`,后者无法精确表示 18 位 TSO。

ticdc/ticdc-debezium.md:614

  • 表格行里同样建议将类型名 uint64 用反引号标注,便于读者识别为数据类型,并与上文注意事项的写法保持一致。
| `payload.source.start_ts`      | 数值  | 源事务的开始 TSO。仅在启用 `debezium-include-start-ts` 或 `[sink.debezium] include-start-ts` 时出现。原始 uint64 PD TSO,不是毫秒时间戳。 |

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ticdc/ticdc-debezium.md
Comment on lines +38 to +40
```
kafka://127.0.0.1:9092/topic-name?protocol=debezium&debezium-include-start-ts=true
```
Comment thread ticdc/ticdc-debezium.md
Comment on lines +53 to +55
- DML 消息的 value 会在 `commit_ts` 旁增加整型字段 `source.start_ts`,JSON schema 将该字段声明为 `int64`。
- DDL 事件、WATERMARK 事件、key 消息和 Debezium Avro 不受影响。将该选项与 Debezium Avro 协议一起使用会被拒绝。
- 如需回滚,关闭该选项即可。关闭期间产出的消息与此前格式保持兼容。
| `compression` | 设置发送消息时使用的压缩算法(可选值为 `none`、`lz4`、`gzip`、`snappy` 和 `zstd`,默认值为 `none`)。注意 Snappy 压缩文件必须遵循[官方 Snappy 格式](https://github.com/google/snappy)。不支持其他非官方压缩格式。|
| `auto-create-topic` | 当传入的 `topic-name` 在 Kafka 集群不存在时,TiCDC 是否要自动创建该 topic(可选,默认值 `true`)。 |
| `enable-tidb-extension` | 可选,默认值是 `false`。当输出协议为 `canal-json` 时,如果该值为 `true`,TiCDC 会发送 [WATERMARK 事件](/ticdc/ticdc-canal-json.md#watermark-event),并在 Kafka 消息中添加 TiDB 扩展字段。从 6.1.0 开始,该参数也可以和输出协议 `avro` 一起使用。如果该值为 `true`,TiCDC 会在 Kafka 消息中添加[三个 TiDB 扩展字段](/ticdc/ticdc-avro-protocol.md#tidb-扩展字段)。|
| `debezium-include-start-ts` | 可选,从 v8.5.9 开始引入,默认值是 `false`。仅当 `protocol` 为 `debezium` 时生效。如果该值为 `true`,TiCDC 会在 Debezium JSON DML 消息中添加 `source.start_ts`(源事务的原始 PD TSO)。显式指定的 URI 参数优先于配置文件中的 `[sink.debezium] include-start-ts`。该选项与 Debezium Avro 一起使用会被拒绝。详情请参考 [TiCDC Debezium Protocol](/ticdc/ticdc-debezium.md#包含事务开始-tso)。 |
- 控制 Debezium JSON DML 消息是否包含 `source.start_ts`(源事务的原始 PD TSO)。
- 默认值:`false`
- 该参数只有当 sink 类型为 MQ 且输出协议为 Debezium JSON 时才生效。与 Debezium Avro 一起设置会被拒绝。
- 你也可以设置等价的 URI 参数 `debezium-include-start-ts`。显式指定的 URI 参数优先于该配置项,包括使用 `false` 覆盖 `true`。

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 799e85ae-e1f8-4ad7-b327-ef5b30376447

📥 Commits

Reviewing files that changed from the base of the PR and between d189954 and 92bb802.

📒 Files selected for processing (4)
  • ticdc/ticdc-changefeed-config.md
  • ticdc/ticdc-debezium.md
  • ticdc/ticdc-open-api-v2.md
  • ticdc/ticdc-sink-to-kafka.md

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.

| 参数名 | 说明 |
|:-------------------|:-------------------------------------------------------------------|
| `output_old_value` | `BOOLEAN` 类型,是否输出行数据更改前的值。默认值为 `true`。关闭后,Update 事件不会输出 "before" 字段的数据。 |
| `include_start_ts` | `BOOLEAN` 类型。从 v8.5.9 开始引入。控制 Debezium JSON DML 消息是否包含 `source.start_ts`(源事务的原始 PD TSO)。默认值为 `false`。 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

补齐 include_start_ts 的完整配置契约。

当前条目没有说明该配置仅对 MQ 的 Debezium JSON 生效,也没有说明 Debezium Avro 的拒绝行为和 debezium-include-start-ts URI 参数优先级。API 用户同时提交 Open API 配置和 sink-uri 时,无法确定最终值。

可直接提交的替换
-| `include_start_ts` | `BOOLEAN` 类型。从 v8.5.9 开始引入。控制 Debezium JSON DML 消息是否包含 `source.start_ts`(源事务的原始 PD TSO)。默认值为 `false`。 |
+| `include_start_ts` | `BOOLEAN` 类型。从 v8.5.9 开始引入。仅当下游为 MQ 且输出协议为 Debezium JSON 时生效。控制 Debezium JSON DML 消息是否包含 `source.start_ts`(源事务的原始 PD TSO)。默认值为 `false`。显式指定的 URI 参数 `debezium-include-start-ts` 优先于该配置项,包括使用 `false` 覆盖 `true`。设置为 `true` 时,与 Debezium Avro 协议一起使用会被拒绝。 |

As per path instructions:该 Markdown 问题可通过连续行的精确替换安全修复。

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `include_start_ts` | `BOOLEAN` 类型。从 v8.5.9 开始引入。控制 Debezium JSON DML 消息是否包含 `source.start_ts`(源事务的原始 PD TSO)。默认值为 `false`|
| `include_start_ts` | `BOOLEAN` 类型。从 v8.5.9 开始引入。仅当下游为 MQ 且输出协议为 Debezium JSON 时生效。控制 Debezium JSON DML 消息是否包含 `source.start_ts`(源事务的原始 PD TSO)。默认值为 `false`。显式指定的 URI 参数 `debezium-include-start-ts` 优先于该配置项,包括使用 `false` 覆盖 `true`。设置为 `true` 时,与 Debezium Avro 协议一起使用会被拒绝|

Source: Path instructions

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

Labels

area/ticdc Indicates that the Issue or PR belongs to the area of TiCDC. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. translation/from-docs This PR is translated from a PR in pingcap/docs. type/enhancement The issue or PR belongs to an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants