Skip to content

cdc: update storage sink (#21221) - #21998

Open
ti-chi-bot wants to merge 1 commit into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-21221-to-release-8.5
Open

ti-chi-bot wants to merge 1 commit into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-21221-to-release-8.5

Conversation

@ti-chi-bot

@ti-chi-bot ti-chi-bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #21221

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).

  • 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)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)

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

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

  • 行为变更
    • TiCDC 新架构启用表级任务拆分时,Storage Sink 数据文件名变更为 CDC_{uuid}_{num}.{extension},索引文件名变更为 CDC_{uuid}.index。下游消费时需根据各子任务的索引文件匹配数据文件,并按 commit-ts 排序处理 DML。
  • 文档
    • 补充了新旧架构下索引文件与数据文件的读取方式,以及相关目录示例。

@ti-chi-bot ti-chi-bot added area/ticdc Indicates that the Issue or PR belongs to the area of TiCDC. lgtm needs-1-more-lgtm Indicates a PR needs 1 more LGTM. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Oct 23, 2026
@ti-chi-bot ti-chi-bot mentioned this pull request Oct 23, 2026
3 of 14 tasks
@ti-chi-bot

ti-chi-bot Bot commented Oct 23, 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 tomshawn 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

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

📝 Walkthrough

本次变更为 TiCDC 文档补充启用表级任务拆分时的 Storage Sink 文件命名、目录示例,以及下游读取 Index 和数据文件并处理 DML 的顺序。

Changes: Storage Sink 文件与消费说明

Layer / File(s) Summary
文件命名与目录示例
releases/release-8.5.5.md, ticdc/ticdc-architecture.md
新增数据文件和 Index 文件的命名格式、路径模板及拆分任务目录示例。
下游文件读取与处理顺序
ticdc/ticdc-storage-consumer-dev-guide.md, ticdc/ticdc-architecture.md
补充不同架构下通过 Index 确定待读数据文件的规则,并说明汇集各子任务的 DML 后按 commit-ts 排序处理。

Priority: ➖ Normal

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

Change: Other

Suggested reviewers: qiancai

Merge Risk: 🟡 Moderate · up to 07aae

Consumers using partitioned or dated storage paths may fail to find Index files and therefore miss data. Correct the lookup path before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning 描述基本完整。它说明这是 #21221 的自动 cherry-pick,填写了适用版本(master 与 v8.5),并给出了相关 TiCDC PR 链接。但“What is changed, added or deleted?”一节为空,未说明本次文档改动的内容,即 Storage Sink 文件命名变更及下游消费顺序说明。该部分为必填项。 在“What is changed, added or deleted? (Required)”下补充以下内容:1)在 v8.5 新架构启用表级任务拆分(scheduler.enable-table-across-nodes)时,Storage Sink 数据文件名由 CDC{num}.{extension} 改为 CDC_{uuid}{num}.{extension},Index 文件名由 CDC.index 改为 CDC{uuid}.index;2)ticdc-arc…
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed 标题“cdc: update storage sink (#21221)”描述了主要变更对象,即 TiCDC 的 Storage Sink。它与变更集相关,但未说明具体改动(文件命名从 CDC{num} 改为 CDC_{uuid}_{num},以及表级任务拆分的相关行为)。该标题较为宽泛,但不是模糊或通用的表述,故判定为通过。
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. (3 skipped: 3 unsupported.)

Full details: Description check

Resolution

在“What is changed, added or deleted? (Required)”下补充以下内容:1)在 v8.5 新架构启用表级任务拆分(scheduler.enable-table-across-nodes)时,Storage Sink 数据文件名由 CDC{num}.{extension} 改为 CDC_{uuid}{num}.{extension},Index 文件名由 CDC.index 改为 CDC{uuid}.index;2)ticdc-architecture.md 与 ticdc-storage-consumer-dev-guide.md 中新增的消费说明,包括读取顺序与按 commit-ts 排序;3)release-8.5.5.md 中的行为变更条目。另请说明“This PR is translated from”一项是否需要填写。

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@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
📥 Commits

Reviewing files that changed from the base of the PR and between 6adbbbc and 07aaedc.

📒 Files selected for processing: 3
  • releases/release-8.5.5.md
  • ticdc/ticdc-architecture.md
  • ticdc/ticdc-storage-consumer-dev-guide.md

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


在处理文件时,可能会出现某个数据文件尚未完全写入就被下游读取的情况,导致这部分数据未被成功读取。为了避免这种情况,编写下游消费程序时,请按照以下顺序读取数据:

1. 读取 `{schema}/{table}/{table-version-separator}/` 目录下的 Index 文件,获取各个 Index 文件中记录的文件名。未开启表级任务拆分时,读取 `meta/CDC.index`;在 TiCDC 新架构下开启表级任务拆分(`scheduler.enable-table-across-nodes = true`)后,分别读取各个子同步任务对应的 `meta/CDC_{uuid}.index` 文件。

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 | 🟠 Major | ⚡ Quick win

补全 Index 文件的完整路径。

当前步骤遗漏了分区目录和日期目录层级。当这些分隔符非空时,消费者可能扫描错误目录,无法发现 Index 文件。官方 Storage Sink 路径定义也包含这些目录层级。 (docs.pingcap.com)

可直接应用的替换
--- "a/ticdc/ticdc-storage-consumer-dev-guide.md"
+++ "b/ticdc/ticdc-storage-consumer-dev-guide.md"
@@ -185,7 +185,7 @@
 
 在处理文件时,可能会出现某个数据文件尚未完全写入就被下游读取的情况,导致这部分数据未被成功读取。为了避免这种情况,编写下游消费程序时,请按照以下顺序读取数据:
 
-1. 读取 `{schema}/{table}/{table-version-separator}/` 目录下的 Index 文件,获取各个 Index 文件中记录的文件名。未开启表级任务拆分时,读取 `meta/CDC.index`;在 TiCDC 新架构下开启表级任务拆分(`scheduler.enable-table-across-nodes = true`)后,分别读取各个子同步任务对应的 `meta/CDC_{uuid}.index` 文件。
+1. 读取 `{schema}/{table}/{table-version-separator}/{partition-separator}/{date-separator}/meta/` 目录下的 Index 文件,获取各个 Index 文件中记录的文件名。未开启表级任务拆分时,读取 `CDC.index`;在 TiCDC 新架构下开启表级任务拆分(`scheduler.enable-table-across-nodes = true`)后,分别读取各个子同步任务对应的 `CDC_{uuid}.index` 文件。
 2. 对于 [TiCDC 新架构](/ticdc/ticdc-architecture.md),针对每个 `CDC_{uuid}.index`,依次读取与该 Index 文件具有相同 `uuid`,且文件序号小于或等于该 Index 文件记录序号的数据文件。对于 [TiCDC 老架构](/ticdc/ticdc-classic-architecture.md),依次读取文件序号小于该文件名中序号的文件。
 
 > **注意:**
📝 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
1. 读取 `{schema}/{table}/{table-version-separator}/` 目录下的 Index 文件,获取各个 Index 文件中记录的文件名。未开启表级任务拆分时,读取 `meta/CDC.index`;在 TiCDC 新架构下开启表级任务拆分(`scheduler.enable-table-across-nodes = true`)后,分别读取各个子同步任务对应的 `meta/CDC_{uuid}.index` 文件。
1. 读取 `{schema}/{table}/{table-version-separator}/{partition-separator}/{date-separator}/meta/` 目录下的 Index 文件,获取各个 Index 文件中记录的文件名。未开启表级任务拆分时,读取 `CDC.index`;在 TiCDC 新架构下开启表级任务拆分(`scheduler.enable-table-across-nodes = true`)后,分别读取各个子同步任务对应的 `CDC_{uuid}.index` 文件。

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. lgtm needs-1-more-lgtm Indicates a PR needs 1 more LGTM. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants