-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ticdc: improve description about ticdc compatibility with lightning & BR #20733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lidezhu
wants to merge
10
commits into
master
Choose a base branch
from
ldz/update-lightning-compatibility
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+19
−10
Open
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
736ff16
improve description about ticdc compatibility
lidezhu ad05d30
small fix
lidezhu 9c59955
small fix
lidezhu 41f244d
Update ticdc/ticdc-faq.md
lidezhu 1c4792c
Apply suggestions from code review
hfxsd f92238c
Update ticdc/ticdc-faq.md
hfxsd 83aaf61
fix link
hfxsd 1dde274
Update ticdc-overview.md
hfxsd 0660c20
Update ticdc/ticdc-faq.md
lidezhu d95920d
Update ticdc/ticdc-faq.md
lidezhu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -360,22 +360,33 @@ TiCDC 提供至少一次的数据同步保证,当下游有重复数据时, | |
|
||
TiCDC 需要磁盘是为了缓冲上游写入高峰时下游消费不及时堆积的数据。TiCDC 正常运行期间都需要写入磁盘,但这通常不是同步吞吐和同步延时的瓶颈,写磁盘对延时影响在百毫秒内。TiCDC 也利用了内存来提升加速读取磁盘中的数据,以提升同步性能。 | ||
|
||
## 为什么在上游使用了 TiDB Lightning 物理导入模式和 BR 恢复了数据之后,TiCDC 同步会出现卡顿甚至卡住? | ||
## TiDB Lightning 物理导入模式与 TiCDC 的兼容性存在哪些限制? | ||
|
||
目前 TiCDC 尚未完全适配 TiDB Lightning [物理导入模式 (Physical Import Mode)](/tidb-lightning/tidb-lightning-physical-import-mode.md) 和 BR,请避免在使用 TiCDC 同步的表上使用 TiDB Lightning 物理导入模式和 BR。否则,可能会出现未知的错误,例如 TiCDC 同步卡住、同步延迟大幅增加、或者同步数据丢失。 | ||
TiDB Lightning [物理导入模式 (Physical Import Mode)](/tidb-lightning/tidb-lightning-physical-import-mode.md) 是直接将数据生成为 SST 文件并导入 TiKV 集群。由于这种导入方式不涉及常规的数据写入流程,因此不会产生 change log 记录。在大多数情况下,changefeed 无法观察到这部分数据的变更。只有在 changefeed 初始化阶段,或者 Region 发生变更(如 split/merge/leader 迁移等)触发增量扫描时,才有可能看到这部分数据,因此 changefeed 并不能完整捕获通过 TiDB Lightning 物理导入模式导入的数据。 | ||
|
||
如果有某些使用 TiCDC 同步的表需要使用 TiDB Lightning 物理导入模式或者 BR 恢复数据,可以这么做: | ||
如果 TiDB Lightning 物理导入模式操作的表与 changefeed 监听的表存在重叠,可能由于数据捕获不完整发生各种未知的错误,例如 changefeed 同步卡住,上下游数据不一致等。如需使用 TiDB Lightning 物理导入模式导入 TiCDC 同步的表,可以按照以下步骤操作: | ||
|
||
1. 删除涉及这些表的 TiCDC 同步任务。 | ||
|
||
2. 使用 TiDB Lightning 物理导入模式或 BR 在 TiCDC 的上游集群和下游集群分别恢复数据。 | ||
2. 使用 TiDB Lightning 物理导入模式在 TiCDC 的上游集群和下游集群分别恢复数据。 | ||
|
||
3. 恢复完成并检查了上下游集群对应表的数据一致性之后,使用上游备份的时间点 (TSO) 作为 TiCDC 同步任务的 `start-ts`,创建新的 TiCDC 同步任务,进行增量同步。例如,假设上游集群的 BR 备份的 snapshot 时间点为 `431434047157698561`,那么可以使用以下命令创建新的 TiCDC 同步任务: | ||
3. 恢复完成并检查了上下游集群对应表的数据一致性之后,使用TiDB Lightning 物理导入模式完成后的时间点 (TSO) 作为 TiCDC 同步任务的 `start-ts`,创建新的 TiCDC 同步任务,进行增量同步。 | ||
|
||
```shell | ||
cdc cli changefeed create -c "upstream-to-downstream-some-tables" --start-ts=431434047157698561 --sink-uri="mysql://[email protected]:4000? time-zone=" | ||
``` | ||
|
||
如果可以确认 TiDB Lightning 物理导入模式操作的表与 changefeed 监听的表不存在重叠关系,可以将 [TiDB Lightning 配置文件](/tidb-lightning/tidb-lightning-configuration.md#tidb-lightning-任务配置) 的 `check-requirements` 设置为 `false`,强制执行数据导入操作。 | ||
|
||
## BR (Backup & Restore) 和 TiCDC 的兼容性存在哪些限制? | ||
|
||
BR (Backup & Restore) 工具也是直接将数据生成为 SST 文件并导入 TiKV 集群,Changefeed 并不能完整捕获通过这类方式导入的数据。详情参考 [TiDB Lightning 物理导入模式与 TiCDC 的兼容性存在哪些限制](/ticdc/ticdc-faq.md#tidb-lightning-物理导入模式与-ticdc-的兼容性存在哪些限制)。 | ||
|
||
不同版本的 BR 处理方式不同: | ||
|
||
- 对于 v8.2.0 之前的版本,如果集群上已存在 changefeed 任务,BR 将拒绝创建恢复任务。 | ||
- 从 v8.2.0 开始,仅当 BR 恢复数据的 backupTs 小于集群上所有 changefeed 的 checkpointTs 时,才允许创建恢复任务。 | ||
|
||
## 为什么恢复暂停的 changefeed 后,changefeed 同步延迟越来越高,数分钟后才恢复正常? | ||
|
||
当 changefeed 启动时,为了补齐 changefeed 暂停期间产生的增量数据日志,TiCDC 需要扫描 TiKV 中数据的历史版本,待扫描完毕后,才能够继续推进复制过程,扫描过程可能长达数分钟到数十分钟。 | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.