From 7f90d7f354a98a814d2a9e6de9d4a91d8024040a Mon Sep 17 00:00:00 2001 From: Ran Date: Thu, 2 Nov 2023 15:04:38 +0800 Subject: [PATCH 1/5] 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 97848c8e11cc10975c3469ef391704eb01fbee03 Mon Sep 17 00:00:00 2001 From: Ran Date: Thu, 2 Nov 2023 15:04:42 +0800 Subject: [PATCH 2/5] 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 260221f482045852509f7bea6c282cce6e577dee Mon Sep 17 00:00:00 2001 From: Ran Date: Thu, 2 Nov 2023 16:03:34 +0800 Subject: [PATCH 3/5] add translation --- ticdc/ticdc-changefeed-config.md | 4 ++++ ticdc/ticdc-ddl.md | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/ticdc/ticdc-changefeed-config.md b/ticdc/ticdc-changefeed-config.md index 2522957f0ff0b..7faedb3916fc6 100644 --- a/ticdc/ticdc-changefeed-config.md +++ b/ticdc/ticdc-changefeed-config.md @@ -67,6 +67,10 @@ enable-old-value = true # Note: This configuration item only takes effect if the downstream is TiDB. # sync-point-retention = "1h" +# Specifies the SQL mode used when parsing DDL statements. Multiple modes are separated by commas. +# The default value is the same as the default SQL mode of TiDB. +# sql-mode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" + [mounter] # The number of threads with which the mounter decodes KV data. The default value is 16. # worker-num = 16 diff --git a/ticdc/ticdc-ddl.md b/ticdc/ticdc-ddl.md index 822c1a89d186e..c6a620774dcdb 100644 --- a/ticdc/ticdc-ddl.md +++ b/ticdc/ticdc-ddl.md @@ -90,3 +90,26 @@ TiCDC processes this type of DDL as follows: | `RENAME TABLE test.t1 TO test.ignore1, test.t3 TO test.ignore2` | Replicate | The old database name, the old table names, and the new database name match the filter rule. | | `RENAME TABLE test.t1 TO ignore.t1, test.t2 TO test.t22;` | Report an error | The new database name `ignore` does not match the filter rule. | | `RENAME TABLE test.t1 TO test.t4, test.t3 TO test.t1, test.t4 TO test.t3;` | Report an error | The `RENAME TABLE` DDL swaps the names of `test.t1` and `test.t3` in one DDL statement, which TiCDC cannot handle correctly. In this case, refer to the error message for handling. | + +### SQL mode + +By default, TiCDC uses the default SQL mode of TiDB to parse DDL statements. If your upstream TiDB cluster uses a non-default SQL mode, you must specify the SQL mode in the TiCDC configuration file. Otherwise, TiCDC might fail to parse DDL statements correctly. For more information about TiDB SQL mode, see [SQL Mode](/sql-mode.md). + +For example, if the upstream TiDB cluster uses the `ANSI_QUOTES` mode, you must specify the SQL mode in the changefeed configuration file as follows: + +```toml +# In the value, "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" is the default SQL mode of TiDB. +# "ANSI_QUOTES" is the SQL mode added to your upstream TiDB cluster. + +sql-mode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES" +``` + +If the SQL mode is not configured, TiCDC might fail to parse some DDL statements correctly. For example: + +```sql +CREATE TABLE "t1" ("a" int PRIMARY KEY); +``` + +Because in the default SQL mode of TiDB, double quotation marks are treated as strings rather than identifiers, TiCDC fails to parse the DDL statement correctly. + +Therefore, when creating a replication task, it is recommended that you specify the SQL mode used by the upstream TiDB cluster in the configuration file. From 36c85e5ab986fc3a24abb5c10bd35c5956e09e38 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Mon, 25 Dec 2023 15:13:23 +0800 Subject: [PATCH 4/5] Update ticdc/ticdc-changefeed-config.md --- ticdc/ticdc-changefeed-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ticdc/ticdc-changefeed-config.md b/ticdc/ticdc-changefeed-config.md index 7faedb3916fc6..61825e504a819 100644 --- a/ticdc/ticdc-changefeed-config.md +++ b/ticdc/ticdc-changefeed-config.md @@ -67,7 +67,7 @@ enable-old-value = true # Note: This configuration item only takes effect if the downstream is TiDB. # sync-point-retention = "1h" -# Specifies the SQL mode used when parsing DDL statements. Multiple modes are separated by commas. +# Starting from v6.5.6, this configuration item specifies the SQL mode used when parsing DDL statements. Multiple modes are separated by commas. # The default value is the same as the default SQL mode of TiDB. # sql-mode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" From df933d72c85dda293761c959b845c4d61e9f1493 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Mon, 25 Dec 2023 15:13:49 +0800 Subject: [PATCH 5/5] Update ticdc/ticdc-changefeed-config.md --- ticdc/ticdc-changefeed-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ticdc/ticdc-changefeed-config.md b/ticdc/ticdc-changefeed-config.md index 61825e504a819..e01aca93c51ea 100644 --- a/ticdc/ticdc-changefeed-config.md +++ b/ticdc/ticdc-changefeed-config.md @@ -67,7 +67,7 @@ enable-old-value = true # Note: This configuration item only takes effect if the downstream is TiDB. # sync-point-retention = "1h" -# Starting from v6.5.6, this configuration item specifies the SQL mode used when parsing DDL statements. Multiple modes are separated by commas. +# Starting from v6.5.6 and v7.1.3, this configuration item specifies the SQL mode used when parsing DDL statements. Multiple modes are separated by commas. # The default value is the same as the default SQL mode of TiDB. # sql-mode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"