Skip to content

Commit 861f50e

Browse files
committed
Merge branch 'main' of github.com:pingcap/docs-staging
2 parents afbf519 + 61bb97f commit 861f50e

File tree

1 file changed

+41
-34
lines changed

1 file changed

+41
-34
lines changed

markdown-pages/en/tidb/release-8.5/ticdc/ticdc-bidirectional-replication.md

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -44,46 +44,50 @@ Replicable DDLs are the DDLs that can be directly executed and replicated to oth
4444

4545
Replicable DDLs include:
4646

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
48+
- [`ALTER TABLE ... ADD INDEX`](/sql-statements/sql-statement-add-index.md) (non-unique)
49+
- [`ALTER TABLE ... ADD PARTITION`](/sql-statements/sql-statement-alter-table.md)
50+
- [`ALTER TABLE ... ALTER COLUMN DROP DEFAULT`](/sql-statements/sql-statement-alter-table.md)
51+
- [`ALTER TABLE ... ALTER COLUMN SET DEFAULT`](/sql-statements/sql-statement-alter-table.md)
52+
- [`ALTER TABLE ... COMMENT=...`](/sql-statements/sql-statement-alter-table.md)
53+
- [`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
55+
- [`ALTER TABLE ... RENAME INDEX`](/sql-statements/sql-statement-rename-index.md)
56+
- [`ALTER TABLE ... ALTER INDEX ... INVISIBLE`](/sql-statements/sql-statement-alter-table.md)
57+
- [`ALTER TABLE ... ALTER INDEX ... VISIBLE`](/sql-statements/sql-statement-alter-table.md)
58+
- [`ALTER TABLE REMOVE TTL`](/sql-statements/sql-statement-alter-table.md)
59+
- [`ALTER TABLE TTL`](/sql-statements/sql-statement-alter-table.md)
60+
- [`CREATE DATABASE`](/sql-statements/sql-statement-create-database.md)
61+
- [`CREATE INDEX`](/sql-statements/sql-statement-create-index.md)
62+
- [`CREATE TABLE`](/sql-statements/sql-statement-create-table.md)
63+
- [`CREATE VIEW`](/sql-statements/sql-statement-create-view.md)
64+
- [`DROP INDEX`](/sql-statements/sql-statement-drop-index.md)
65+
- [`DROP VIEW`](/sql-statements/sql-statement-drop-view.md)
6366

6467
### Non-replicable DDLs
6568

6669
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.
6770

6871
Non-replicable DDLs include:
6972

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`
75+
- [`ALTER TABLE ... ADD PRIMARY KEY`](/sql-statements/sql-statement-alter-table.md)
76+
- [`ALTER TABLE ... ADD UNIQUE INDEX`](/sql-statements/sql-statement-alter-table.md)
77+
- [`ALTER TABLE ... AUTO_INCREMENT=...`](/sql-statements/sql-statement-alter-table.md)
78+
- [`ALTER TABLE ... AUTO_RANDOM_BASE=...`](/sql-statements/sql-statement-alter-table.md)
79+
- [`ALTER TABLE ... CHARACTER SET=...`](/sql-statements/sql-statement-alter-table.md)
80+
- [`ALTER TABLE ... DROP COLUMN`](/sql-statements/sql-statement-alter-table.md)
81+
- [`ALTER TABLE ... DROP PARTITION`](/sql-statements/sql-statement-alter-table.md)
82+
- [`ALTER TABLE ... EXCHANGE PARTITION`](/sql-statements/sql-statement-alter-table.md)
83+
- [`ALTER TABLE ... MODIFY COLUMN`](/sql-statements/sql-statement-modify-column.md): you can modify the attributes of the column except `default value` and `comment`
84+
- [`ALTER TABLE ... REORGANIZE PARTITION`](/sql-statements/sql-statement-alter-table.md)
85+
- [`ALTER TABLE ... TRUNCATE PARTITION`](/sql-statements/sql-statement-alter-table.md)
86+
- [`DROP DATABASE`](/sql-statements/sql-statement-drop-database.md)
87+
- [`DROP TABLE`](/sql-statements/sql-statement-drop-table.md)
88+
- [`RECOVER TABLE`](/sql-statements/sql-statement-recover-table.md)
89+
- [`RENAME TABLE`](/sql-statements/sql-statement-rename-table.md)
90+
- [`TRUNCATE TABLE`](/sql-statements/sql-statement-truncate.md)
8791

8892
## DDL replication
8993

@@ -102,6 +106,9 @@ In short, in BDR mode, TiCDC only replicates replicable DDLs in the PRIMARY clus
102106

103107
```sql
104108
ADMIN SET BDR ROLE PRIMARY;
109+
```
110+
111+
```
105112
Query OK, 0 rows affected
106113
Time: 0.003s
107114

@@ -152,7 +159,7 @@ After the check is completed, you can stop the changefeed to stop bi-directional
152159
>
153160
> 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.
154161

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:
156163

157164
- In Cluster A, set `auto_increment_increment=3` and `auto_increment_offset=2000`
158165
- In Cluster B, set `auto_increment_increment=3` and `auto_increment_offset=2001`

0 commit comments

Comments
 (0)