From a44e11db67fd26747e4a9dbf0702e04cadc5b9b7 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Thu, 20 Feb 2025 16:33:13 +0800 Subject: [PATCH 1/3] Add temp.md --- temp.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 temp.md diff --git a/temp.md b/temp.md new file mode 100644 index 0000000000000..af27ff4986a7b --- /dev/null +++ b/temp.md @@ -0,0 +1 @@ +This is a test file. \ No newline at end of file From 9ead8bd3912edc20afd3b4ff07ab7ceae701d7fe Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Thu, 20 Feb 2025 16:33:19 +0800 Subject: [PATCH 2/3] Delete temp.md --- temp.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 temp.md diff --git a/temp.md b/temp.md deleted file mode 100644 index af27ff4986a7b..0000000000000 --- a/temp.md +++ /dev/null @@ -1 +0,0 @@ -This is a test file. \ No newline at end of file From bbabf1fd1f0e36b676898cd694dba0d7a64eda22 Mon Sep 17 00:00:00 2001 From: qiancai Date: Thu, 20 Feb 2025 17:10:20 +0800 Subject: [PATCH 3/3] add translation --- ticdc/ticdc-manage-changefeed.md | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/ticdc/ticdc-manage-changefeed.md b/ticdc/ticdc-manage-changefeed.md index 016d141429bc3..87e5f9d47e98a 100644 --- a/ticdc/ticdc-manage-changefeed.md +++ b/ticdc/ticdc-manage-changefeed.md @@ -255,6 +255,39 @@ Currently, you can modify the following configuration items: - `resolved-ts`: The largest TSO among the sorted data in the current processor. - `checkpoint-ts`: The largest TSO that has been successfully written to the downstream in the current processor. +## Security mechanism + +Starting from v9.0.0, TiCDC introduces a security mechanism to prevent users from accidentally configuring the same TiDB cluster as both the upstream and downstream for data replication, which could lead to circular replication and data anomalies. + +When creating, updating, or resuming a replication task, TiCDC automatically checks whether the upstream and downstream TiDB clusters have the same `cluster_id`. If TiCDC detects the same `cluster_id` for both the upstream and downstream, it will reject the operation. The `cluster_id` (introduced in v9.0.0) is a unique identifier for TiDB clusters. You can query it using the following SQL statement: + +```sql +SELECT VARIABLE_VALUE FROM mysql.tidb WHERE VARIABLE_NAME = 'cluster_id'; +``` + +### Compatibility + +- For non-TiDB downstream systems (such as MySQL, Kafka, etc.), TiCDC skips this check to ensure compatibility. +- For TiDB versions earlier than v9.0.0, the system cannot retrieve the `cluster_id`, so TiCDC still allows you to create replication tasks to ensure no impact on existing functionality. In these cases, because of the lack of `cluster_id`, you need to manually check the configurations to avoid potential issues. + +### Example error messages + +When creating, updating, or resuming a replication task, TiCDC will report an error if it detects the same `cluster_id` for both the upstream and downstream TiDB clusters. The following is a typical example: + +When using the CLI command to create a replication task with the same cluster as both the upstream and downstream: + +``` +cdc cli changefeed create --server=http://127.0.0.1:8300 --sink-uri="mysql://root:@127.0.0.1:8300/" --changefeed-id="create-cmd" +``` + +You will receive the following error message: + +``` +Error: [CDC:ErrSameUpstreamDownstream]TiCDC does not support creating a changefeed with the same TiDB cluster as both the source and the target for the changefeed. +``` + +This error message includes the error code `CDC:ErrSameUpstreamDownstream`, indicating that TiCDC detected the same cluster being used as both the upstream and downstream. If you encounter this error, check whether the `sink-uri` parameter for your replication task is configured correctly. + ## Replicate tables with the new framework for collations enabled Starting from v4.0.15, v5.0.4, v5.1.1 and v5.2.0, TiCDC supports tables that have enabled [new framework for collations](/character-set-and-collation.md#new-framework-for-collations).