cdc: add kafka max-message-bytes related explain - #21832
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough更新 TiCDC Kafka 文档,明确 ChangesKafka 消息大小语义与处理
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c7f382b1-4b18-4ca0-89d0-42629e7ba666
📒 Files selected for processing (3)
ticdc/ticdc-faq.mdticdc/ticdc-sink-to-kafka.mdticdc/troubleshoot-ticdc.md
| ## TiCDC 把数据同步到 Kafka 时,能在 TiDB 中控制单条消息大小的上限吗? | ||
|
|
||
| 对于 Avro 和 Canal-JSON 格式,消息是以行变更为单位发送的,一条 Kafka Message 仅包含一条行变更。一般情况下,消息的大小不会超过 Kafka 单条消息上限,因此,一般不需要限制单条消息大小。如果单条 Kafka 消息大小确实超过 Kafka 上限,请参考[为什么 TiCDC 到 Kafka 的同步任务延时越来越大](/ticdc/ticdc-faq.md#为什么-ticdc-到-kafka-的同步任务延时越来越大)。 | ||
| `max-message-bytes` 控制 TiCDC 将多条行变更合并为一条 Kafka message 时的大小,默认值为 `10 MB`。该参数不限制单条行变更编码后的消息大小。Kafka 能接收的消息大小由 Topic 的 `max.message.bytes` 或 broker 的 `message.max.bytes` 决定。 |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
补充 max-message-bytes 默认值的版本范围。
Line 243 将 10 MB 写成无条件默认值,但参数表说明该默认值仅从 v5.0.6 和 v4.0.6 开始生效;FAQ 对旧版本用户会产生误导。
建议替换
| `max-message-bytes` 控制 TiCDC 将多条行变更合并为一条 Kafka message 时的大小,默认值为 `10 MB`。该参数不限制单条行变更编码后的消息大小。Kafka 能接收的消息大小由 Topic 的 `max.message.bytes` 或 broker 的 `message.max.bytes` 决定。 | |
| `max-message-bytes` 控制 TiCDC 将多条行变更合并为一条 Kafka message 时的大小,默认值为 `10 MB`。从 v5.0.6 和 v4.0.6 开始,该参数的默认值分别从 `64 MB` 和 `256 MB` 调整至 `10 MB`。该参数不限制单条行变更编码后的消息大小。Kafka 能接收的消息大小由 Topic 的 `max.message.bytes` 或 broker 的 `message.max.bytes` 决定。 |
根据路径说明:可安全连续替换的修复必须提供 GitHub committable suggestion。
Source: Path instructions
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 1a5037df-581d-4431-a64d-c0d5aacb9a66
📒 Files selected for processing (4)
ticdc/ticdc-faq.mdticdc/ticdc-open-protocol.mdticdc/ticdc-sink-to-kafka.mdticdc/troubleshoot-ticdc.md
💤 Files with no reviewable changes (1)
- ticdc/ticdc-faq.md
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 1c98e889-9bb5-47fb-9067-abae08ecd22a
📒 Files selected for processing (3)
ticdc/ticdc-open-protocol.mdticdc/ticdc-sink-to-kafka.mdticdc/troubleshoot-ticdc.md
| | `max-batch-size` | 每条 Message 最多包含的 Row Changed Event 数量,默认值为 `16`。 | | ||
| | `max-message-bytes` | 控制 Message 的大小阈值。 | | ||
|
|
||
| Kafka Sink 会比较 changefeed 中配置的 `max-message-bytes` 与 Kafka 允许的消息大小限制,并使用其中的较小值作为实际阈值,避免批量编码后的 Message 超过 Kafka 允许的大小。Kafka 消息大小限制的确定方式参见[Kafka 消息大小限制](/ticdc/ticdc-sink-to-kafka.md#kafka-消息大小限制)。 |
There was a problem hiding this comment.
| Kafka Sink 会比较 changefeed 中配置的 `max-message-bytes` 与 Kafka 允许的消息大小限制,并使用其中的较小值作为实际阈值,避免批量编码后的 Message 超过 Kafka 允许的大小。Kafka 消息大小限制的确定方式参见[Kafka 消息大小限制](/ticdc/ticdc-sink-to-kafka.md#kafka-消息大小限制)。 | |
| Kafka Sink 会比较 changefeed 中配置的 `max-message-bytes` 与 Kafka 允许的消息大小限制,并使用其中的较小值作为 Message 大小的实际阈值。Kafka 消息大小限制的确定方式参见 [Kafka 消息大小限制](/ticdc/ticdc-sink-to-kafka.md#kafka-消息大小限制)。 | |
| | 参数 | 作用 | | ||
| | --- | --- | | ||
| | `max-batch-size` | 每条 Message 最多包含的 Row Changed Event 数量,默认值为 `16`。 | | ||
| | `max-message-bytes` | 控制 Message 的大小阈值。 | |
There was a problem hiding this comment.
| | `max-message-bytes` | 控制 Message 的大小阈值。 | | |
| | `max-message-bytes` | 将多个 Row Changed Event 编码为一条 Message 时的大小阈值,默认值为 `10 MB`。 | |
| | `kafka-client-id` | 指定同步任务的 Kafka 客户端的 ID(可选,默认值为 `TiCDC_sarama_producer_同步任务的 ID`)。 | | ||
| | `partition-num` | 下游 Kafka partition 数量(可选,不能大于实际 partition 数量,否则创建同步任务会失败,默认值 `3`)。| | ||
| | `max-message-bytes` | 每次向 Kafka broker 发送消息的最大数据量(可选,默认值 `10MB`,最大值为 `100MB`)。从 v5.0.6 和 v4.0.6 开始,默认值分别从 `64MB` 和 `256MB` 调整至 `10MB`。| | ||
| | `max-message-bytes` | Open Protocol Message 的大小阈值(可选,默认值 `10 MB`,最大值为 `100 MB`)。实际生效规则参见[控制 Message 中的 Event 数量和大小](/ticdc/ticdc-open-protocol.md#控制-message-中的-event-数量和大小)。| |
There was a problem hiding this comment.
| | `max-message-bytes` | Open Protocol Message 的大小阈值(可选,默认值 `10 MB`,最大值为 `100 MB`)。实际生效规则参见[控制 Message 中的 Event 数量和大小](/ticdc/ticdc-open-protocol.md#控制-message-中的-event-数量和大小)。| | |
| | `max-message-bytes` | Open Protocol 批量编码时每条 Message 的大小阈值(可选,默认值 `10 MB`,最大值为 `100 MB`)。实际生效规则参见[控制 Message 中的 Event 数量和大小](/ticdc/ticdc-open-protocol.md#控制-message-中的-event-数量和大小)。| |
| | `partition-num` | 下游 Kafka partition 数量(可选,不能大于实际 partition 数量,否则创建同步任务会失败,默认值 `3`)。| | ||
| | `max-message-bytes` | 每次向 Kafka broker 发送消息的最大数据量(可选,默认值 `10MB`,最大值为 `100MB`)。从 v5.0.6 和 v4.0.6 开始,默认值分别从 `64MB` 和 `256MB` 调整至 `10MB`。| | ||
| | `max-message-bytes` | Open Protocol Message 的大小阈值(可选,默认值 `10 MB`,最大值为 `100 MB`)。实际生效规则参见[控制 Message 中的 Event 数量和大小](/ticdc/ticdc-open-protocol.md#控制-message-中的-event-数量和大小)。| | ||
| | `max-batch-size` | Open Protocol Message 最多包含的 Row Changed Event 数量(可选,默认值 `16`)。详细说明参见[控制 Message 中的 Event 数量和大小](/ticdc/ticdc-open-protocol.md#控制-message-中的-event-数量和大小)。| |
There was a problem hiding this comment.
| | `max-batch-size` | Open Protocol Message 最多包含的 Row Changed Event 数量(可选,默认值 `16`)。详细说明参见[控制 Message 中的 Event 数量和大小](/ticdc/ticdc-open-protocol.md#控制-message-中的-event-数量和大小)。| | |
| | `max-batch-size` | Open Protocol 每条 Message 最多包含的 Row Changed Event 数量(可选,默认值 `16`)。详细说明参见[控制 Message 中的 Event 数量和大小](/ticdc/ticdc-open-protocol.md#控制-message-中的-event-数量和大小)。| |
|
|
||
| Kafka Sink 会比较 changefeed 中配置的 `max-message-bytes` 与 Kafka 允许的消息大小限制,并使用其中的较小值作为实际阈值,避免批量编码后的 Message 超过 Kafka 允许的大小。Kafka 消息大小限制的确定方式参见[Kafka 消息大小限制](/ticdc/ticdc-sink-to-kafka.md#kafka-消息大小限制)。 | ||
|
|
||
| 当 Message 中的 Row Changed Event 数量已经达到 `max-batch-size`,或者继续加入下一个 Row Changed Event 会使 Message 超过实际生效的大小阈值时,后续 Row Changed Event 会被写入一条新的 Message。 |
There was a problem hiding this comment.
| 当 Message 中的 Row Changed Event 数量已经达到 `max-batch-size`,或者继续加入下一个 Row Changed Event 会使 Message 超过实际生效的大小阈值时,后续 Row Changed Event 会被写入一条新的 Message。 | |
| 当 Message 中的 Row Changed Event 数量已经达到 `max-batch-size`,或者在此 Message 中加入下一个 Row Changed Event 会使 Message 超过实际生效的大小阈值时,后续 Row Changed Event 会被写入一条新的 Message。 | |
| 需要注意的是,如果单个 Row Changed Event 编码后的 Message 大小已经超过 `max-message-bytes`,但未超过 Kafka 的消息大小限制,该 Event 仍会作为单独一条 Message 正常发送。 |
First-time contributors' checklist
What is changed, added or deleted? (Required)
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).
What is the related PR or file link(s)?
This PR is translated from:
Other reference link(s):
AI agent involvement
Do your changes match any of the following descriptions?
Summary by CodeRabbit
max-message-bytes仅用于多条行变更合并为同一 Kafka message 的大小阈值(默认 10MB,最大 100MB),不限制单条行变更编码后的大小;补充默认值调整与 Open Protocol 相关规则。max-batch-size/max-message-bytes,超阈按新 message 切分。ErrMessageTooLarge/Message was too large故障处理:按版本优先调 Topic/Broker 限制,并补充large-message-handle-option等可选方案。