Skip to content

dm: add LOCK TABLES privilege note for managed MySQL sources (8.5)#22606

Open
alastori wants to merge 2 commits intopingcap:release-8.5from
alastori:fix/dm-lock-tables-managed-mysql-8.5
Open

dm: add LOCK TABLES privilege note for managed MySQL sources (8.5)#22606
alastori wants to merge 2 commits intopingcap:release-8.5from
alastori:fix/dm-lock-tables-managed-mysql-8.5

Conversation

@alastori
Copy link
Collaborator

Cherry-pick of #22605 to release-8.5.

Adds conditional LOCK TABLES privilege documentation for managed MySQL sources (RDS, Aurora) to dm-precheck, dm-worker-intro, and quick-start-with-dm.

See #22605 for full context.

Which TiDB version(s) do your changes apply to?

  • v8.5 (LTS)

cc @GMHDBJD @qiancai

@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 20, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign icemap for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the documentation for TiDB Data Migration (DM) by providing crucial information regarding MySQL user privileges, specifically the LOCK TABLES privilege. It addresses scenarios where DM interacts with managed MySQL services like Amazon RDS or Aurora, where certain operations like FLUSH TABLES WITH READ LOCK might be restricted. The changes ensure users are aware of the necessary permissions for proper data consistency during migration.

Highlights

  • Documentation Update for Managed MySQL Privileges: Clarified the requirement for LOCK TABLES privilege when using DM with managed MySQL services (like Amazon RDS or Aurora), especially when FLUSH TABLES WITH READ LOCK is restricted. This update affects dm-precheck, dm-worker-intro, and quick-start-with-dm documentation.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ti-chi-bot ti-chi-bot bot added missing-translation-status This PR does not have translation status info. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 20, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds documentation about the LOCK TABLES privilege requirement for managed MySQL sources like RDS and Aurora when using DM. The changes are applied to the precheck, worker introduction, and quick start guides. My review focuses on improving the clarity and style of the new documentation notes, suggesting minor rephrasing to use active voice and avoid abbreviations, in line with the repository's technical writing style guide.

- SELECT permission on INFORMATION_SCHEMA and dump tables
- RELOAD permission if `consistency=flush`
- LOCK TABLES permission on the dump tables if `consistency=flush/lock`
- 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

To improve readability and adhere to the active voice preference in the style guide, I suggest a minor wording change.

Suggested change
- 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
- 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) that restricts `FLUSH TABLES WITH READ LOCK`
References
  1. The style guide recommends using active voice for clarity (lines 43-45). Changing 'where ... is restricted' to 'that restricts' improves readability. (link)

| `REPLICATION SLAVE` | Global |
| `REPLICATION CLIENT` | Global |

> **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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

To improve clarity and better align with the style guide, I suggest rephrasing this note. The proposed changes use active voice, address the user with 'you', and avoid an undefined abbreviation, making the note easier to understand.

Suggested change
> **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.
> **Note:** If you are migrating from a managed MySQL service (such as Amazon RDS or Aurora) that restricts `FLUSH TABLES WITH READ LOCK`, the database user also needs the `LOCK TABLES` privilege. This is because DM's default `consistency=auto` mode falls back to using `LOCK TABLES` for data consistency when `FLUSH TABLES WITH READ LOCK` is unavailable.
References
  1. The style guide recommends writing in the second person ('you') (line 22), using active voice (lines 43-45), and ensuring clarity for the user (line 14). The suggested change addresses these points and also avoids an undefined abbreviation. (link)

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)
@alastori alastori force-pushed the fix/dm-lock-tables-managed-mysql-8.5 branch from a2f525c to cd4fb2b Compare March 20, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing-translation-status This PR does not have translation status info. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant