You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: markdown-pages/en/tidb/release-8.5/ticdc/ticdc-bidirectional-replication.md
+41-34Lines changed: 41 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,46 +44,50 @@ Replicable DDLs are the DDLs that can be directly executed and replicated to oth
44
44
45
45
Replicable DDLs include:
46
46
47
-
- `CREATE DATABASE`
48
-
- `CREATE TABLE`
49
-
- `ADD COLUMN`: the column can be `null`, or has `not null` and `default value` at the same time
50
-
- `ADD NON-UNIQUE INDEX`
51
-
- `DROP INDEX`
52
-
- `MODIFY COLUMN`: you can only modify the `default value` and `comment` of the column
53
-
- `ALTER COLUMN DEFAULT VALUE`
54
-
- `MODIFY TABLE COMMENT`
55
-
- `RENAME INDEX`
56
-
- `ADD TABLE PARTITION`
57
-
- `DROP PRIMARY KEY`
58
-
- `ALTER TABLE INDEX VISIBILITY`
59
-
- `ALTER TABLE TTL`
60
-
- `ALTER TABLE REMOVE TTL`
61
-
- `CREATE VIEW`
62
-
- `DROP VIEW`
47
+
- [`ALTER TABLE ... ADD COLUMN`](/sql-statements/sql-statement-add-column.md): the column can be `null`, or has `not null` and `default value` at the same time
- [`ALTER TABLE ... DROP PRIMARY KEY`](/sql-statements/sql-statement-alter-table.md)
54
+
- [`ALTER TABLE ... MODIFY COLUMN`](/sql-statements/sql-statement-modify-column.md): you can only modify the `default value` and `comment` of the column
Non-replicable DDLs are the DDLs that have a great impact on the business, and might cause data inconsistency between clusters. Non-replicable DDLs cannot be directly replicated to other TiDB clusters in bi-directional replication through TiCDC. Non-replicable DDLs must be executed through specific operations.
67
70
68
71
Non-replicable DDLs include:
69
72
70
-
- `DROP DATABASE`
71
-
- `DROP TABLE`
72
-
- `ADD COLUMN`: the column is `not null` and does not have a `default value`
73
-
- `DROP COLUMN`
74
-
- `ADD UNIQUE INDEX`
75
-
- `TRUNCATE TABLE`
76
-
- `MODIFY COLUMN`: you can modify the attributes of the column except `default value` and `comment`
77
-
- `RENAME TABLE`
78
-
- `DROP PARTITION`
79
-
- `TRUNCATE PARTITION`
80
-
- `ALTER TABLE CHARACTER SET`
81
-
- `ALTER DATABASE CHARACTER SET`
82
-
- `RECOVER TABLE`
83
-
- `ADD PRIMARY KEY`
84
-
- `REBASE AUTO ID`
85
-
- `EXCHANGE PARTITION`
86
-
- `REORGANIZE PARTITION`
73
+
- [`ALTER DATABASE CHARACTER SET`](/sql-statements/sql-statement-alter-table.md)
74
+
- [`ALTER TABLE ... ADD COLUMN`](/sql-statements/sql-statement-alter-table.md): the column is `not null` and does not have a `default value`
- [`ALTER TABLE ... MODIFY COLUMN`](/sql-statements/sql-statement-modify-column.md): you can modify the attributes of the column except `default value` and `comment`
@@ -102,6 +106,9 @@ In short, in BDR mode, TiCDC only replicates replicable DDLs in the PRIMARY clus
102
106
103
107
```sql
104
108
ADMIN SET BDR ROLE PRIMARY;
109
+
```
110
+
111
+
```
105
112
Query OK, 0 rows affected
106
113
Time: 0.003s
107
114
@@ -152,7 +159,7 @@ After the check is completed, you can stop the changefeed to stop bi-directional
152
159
>
153
160
> Do not set the BDR role in other scenarios, for example, setting `PRIMARY`, `SECONDARY`, and no BDR roles at the same time. If you set the BDR role incorrectly, TiDB cannot guarantee data correctness and consistency during data replication.
154
161
155
-
- Usually do not use `AUTO_INCREMENT` or `AUTO_RANDOM` to avoid data conflicts in the replicated tables. If you need to use `AUTO_INCREMENT` or `AUTO_RANDOM`, you can set different `auto_increment_increment` and `auto_increment_offset` for different clusters to ensure that different clusters can be assigned different primary keys. For example, if there are three TiDB clusters (A, B, and C) in bi-directional replication, you can set them as follows:
162
+
- Usually do not use [`AUTO_INCREMENT`](/auto-increment.md) or [`AUTO_RANDOM`](/auto-random.md) to avoid data conflicts in the replicated tables. If you need to use `AUTO_INCREMENT` or `AUTO_RANDOM`, you can set different `auto_increment_increment` and `auto_increment_offset` for different clusters to ensure that different clusters can be assigned different primary keys. For example, if there are three TiDB clusters (A, B, and C) in bi-directional replication, you can set them as follows:
156
163
157
164
- In Cluster A, set `auto_increment_increment=3` and `auto_increment_offset=2000`
158
165
- In Cluster B, set `auto_increment_increment=3` and `auto_increment_offset=2001`
0 commit comments