Skip to content

dm: add LOCK TABLES privilege note for managed MySQL sources#22605

Open
alastori wants to merge 3 commits intopingcap:masterfrom
alastori:fix/dm-lock-tables-managed-mysql
Open

dm: add LOCK TABLES privilege note for managed MySQL sources#22605
alastori wants to merge 3 commits intopingcap:masterfrom
alastori:fix/dm-lock-tables-managed-mysql

Conversation

@alastori
Copy link
Collaborator

What is changed, added or deleted?

Added conditional LOCK TABLES privilege documentation for managed MySQL sources (Amazon RDS, Aurora, Google Cloud SQL) across three DM docs pages.

Background: DM defaults to consistency=auto. On managed MySQL where FLUSH TABLES WITH READ LOCK is restricted by the cloud provider, DM falls back to LOCK TABLES. This privilege is not needed on self-managed MySQL instances. Confirmed with @GMHDBJD (Minghao Guo): the FTWRL → LOCK TABLES fallback in auto mode is by design.

Changes:

  • dm/dm-precheck.md: Clarified that LOCK TABLES is needed for auto fallback on managed MySQL, not just flush/lock
  • dm/dm-worker-intro.md: Added LOCK TABLES to privilege table with managed-MySQL scope note; added conditional GRANT example
  • dm/quick-start-with-dm.md: Added note pointing to dm-worker-intro for managed MySQL sources (×2 instances)

Evidence: Lab-06: LOCK TABLES privilege testing (9 scenarios, vanilla MySQL vs RDS)

Related:

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

  • master (dev)
  • v8.5 (LTS)

cc @GMHDBJD @qiancai @OliverS929

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)
@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 lance6716 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

@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
@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) to provide clearer guidance on LOCK TABLES privilege requirements for users migrating data from managed MySQL services such as Amazon RDS or Aurora. It addresses the scenario where DM's consistency=auto mode falls back to LOCK TABLES when FLUSH TABLES WITH READ LOCK is restricted by cloud providers, ensuring users correctly configure necessary permissions for successful data migration.

Highlights

  • dm/dm-precheck.md update: Clarified the requirement for LOCK TABLES privilege when consistency=auto is used with managed MySQL services (like Amazon RDS or Aurora) due to FLUSH TABLES WITH READ LOCK restrictions.
  • dm/dm-worker-intro.md update: Incorporated a note and a conditional GRANT example for the LOCK TABLES privilege, specifically for users migrating from managed MySQL services.
  • dm/quick-start-with-dm.md update: Added two notes directing users to the dm-worker-intro.md page for details on LOCK TABLES privileges when using managed MySQL sources.

🧠 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.

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

The pull request enhances the documentation for TiDB Data Migration (DM) by providing clearer guidance on the "LOCK TABLES" privilege, especially for managed MySQL services like Amazon RDS and Aurora. This addresses a specific scenario where DM's consistency=auto mode falls back to LOCK TABLES when FLUSH TABLES WITH READ LOCK is restricted. The changes improve the completeness and accuracy of the privilege requirements across several key documentation pages, making the information more precise and helpful for users.

- dm-precheck.md: separate what precheck checks (consistency=lock) from
  what's needed at runtime (auto fallback), with explicit Note that
  precheck does not currently validate this
- Expand all provider lists to include Azure and Google Cloud SQL
- Use "not permitted" consistently instead of "restricted"
- Fix commented-out GRANT: use separate code block instead
- Also fixes pre-existing error: old text said LOCK TABLES needed for
  consistency=flush, but flush uses FTWRL (RELOAD), not LOCK TABLES
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