Skip to content

Commit 4762c82

Browse files
committed
add LOCK TABLES note for managed MySQL sources in OSS DM docs
When migrating from managed MySQL services (RDS, Aurora) where FTWRL is restricted, DM's consistency=auto mode falls back to LOCK TABLES. Added conditional privilege documentation to dm-worker-intro, dm-precheck, and quick-start-with-dm. Confirmed with Minghao Guo: FTWRL→LOCK TABLES fallback is by design, Cloud DM defaults to consistency=auto. Lab evidence: https://github.com/alastori/tidb-sandbox/tree/main/labs/dm/lab-06-lock-tables-privilege Related: pingcap#22598 (Cloud DM docs) Related: https://tidb.atlassian.net/browse/DM-12687 (pre-check improvement)
1 parent 09bcd4e commit 4762c82

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

dm/dm-precheck.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ For the full data migration mode (`task-mode: full`), in addition to the [common
6969

7070
- SELECT permission on INFORMATION_SCHEMA and dump tables
7171
- RELOAD permission if `consistency=flush`
72-
- LOCK TABLES permission on the dump tables if `consistency=flush/lock`
72+
- LOCK TABLES permission on the dump tables if `consistency=lock`, or if `consistency=auto` and the source is a managed MySQL service (such as Amazon RDS or Aurora) where `FLUSH TABLES WITH READ LOCK` is restricted
7373

7474
* (Mandatory) Consistency of upstream MySQL multi-instance sharding tables
7575

dm/dm-worker-intro.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,16 @@ The upstream database (MySQL/MariaDB) user must have the following privileges:
5252
| `REPLICATION SLAVE` | Global |
5353
| `REPLICATION CLIENT` | Global |
5454

55+
> **Note:** If migrating from a managed MySQL service (such as Amazon RDS or Aurora) where `FLUSH TABLES WITH READ LOCK` is restricted, the user also needs the `LOCK TABLES` privilege. DM's default `consistency=auto` mode falls back to `LOCK TABLES` for data consistency when FTWRL is unavailable.
56+
5557
If you need to migrate the data from `db1` to TiDB, execute the following `GRANT` statement:
5658

5759
```sql
5860
GRANT RELOAD,REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'your_user'@'your_wildcard_of_host';
5961
GRANT SELECT ON db1.* TO 'your_user'@'your_wildcard_of_host';
62+
63+
-- For managed MySQL (Amazon RDS, Aurora, etc.), also grant:
64+
-- GRANT LOCK TABLES ON db1.* TO 'your_user'@'your_wildcard_of_host';
6065
```
6166

6267
If you also need to migrate the data from other databases into TiDB, make sure the same privileges are granted to the user of the respective databases.

dm/quick-start-with-dm.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ You can use Docker to quickly deploy a test MySQL 8.0 instance.
9191
GRANT PROCESS, BACKUP_ADMIN, RELOAD, REPLICATION SLAVE, REPLICATION CLIENT, SELECT ON *.* TO 'tidb-dm'@'%';
9292
```
9393

94+
> **Note:** If your MySQL source is a managed service (such as Amazon RDS or Aurora), also grant `LOCK TABLES`. See [DM-worker privileges](/dm/dm-worker-intro.md#upstream-database-user-privileges) for details.
95+
9496
4. Create sample data:
9597

9698
```sql
@@ -148,6 +150,8 @@ On macOS, you can quickly install and start MySQL 8.0 locally using [Homebrew](h
148150
GRANT PROCESS, BACKUP_ADMIN, RELOAD, REPLICATION SLAVE, REPLICATION CLIENT, SELECT ON *.* TO 'tidb-dm'@'%';
149151
```
150152

153+
> **Note:** If your MySQL source is a managed service (such as Amazon RDS or Aurora), also grant `LOCK TABLES`. See [DM-worker privileges](/dm/dm-worker-intro.md#upstream-database-user-privileges) for details.
154+
151155
6. Create sample data:
152156

153157
```sql

0 commit comments

Comments
 (0)