Skip to content

docs: document database-level read-only mode - #24769

Open
expxiaoli wants to merge 6 commits into
pingcap:masterfrom
expxiaoli:read_only
Open

expxiaoli wants to merge 6 commits into
pingcap:masterfrom
expxiaoli:read_only

Conversation

@expxiaoli

@expxiaoli expxiaoli commented Nov 26, 2026 •

Copy link
Copy Markdown

What is changed, added, or deleted? (Required)

Document database-level read-only mode for migration cutover and data validation:

  • Add a feature guide covering read-only state changes, transaction draining, SQL restrictions, explicit privilege bypass, MySQL compatibility, and interactions with import, backup, restore, and replication tools.
  • Add the INFORMATION_SCHEMA.SCHEMATA_EXTENSIONS reference and query example.
  • Update ALTER DATABASE, SHOW CREATE DATABASE, privilege descriptions, system-variable cross-references, and navigation entries.

Database-level read-only mode is introduced in TiDB v8.5.9. The sequence restore fix in pingcap/tidb#73801 is included in the same release, so no separate version qualification is needed for SQL restoration of sequences in read-only databases.

Validation: Markdown formatting, internal links, link anchors, new-page metadata, and git diff --check passed.

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

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)

What is the related PR or file link(s)?

AI agent involvement

  • The changes in this PR were primarily made by an AI agent on behalf of the PR author.

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Summary by CodeRabbit

  • Documentation
    • Added guidance for database-level read-only mode, including how to enable and check it, its effects on transactions and SQL operations, privilege requirements, compatibility limits, interactions with TiDB tools, and recovery steps.
    • Documented the READ ONLY option for ALTER DATABASE, its supported values, and examples for enabling read-only mode and restoring write access.
    • Added documentation for INFORMATION_SCHEMA.SCHEMATA_EXTENSIONS, including its columns, database settings, and a query example, with navigation links to related pages.
    • Clarified how database-level read-only mode interacts with privileges and cluster-wide restrictions, and how it appears in SHOW CREATE DATABASE output.

@expxiaoli expxiaoli added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Nov 26, 2026
@ti-chi-bot ti-chi-bot Bot added the first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. label Nov 26, 2026
@ti-chi-bot

ti-chi-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown

In response to a cherrypick label: @expxiaoli once the present PR merges, I will cherry-pick it on top of release-8.5 in a new PR and assign it to you.

@ti-chi-bot

ti-chi-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown

[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 tangenta 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

The documentation adds coverage for database-level read-only mode, including SQL controls, transaction behavior, restrictions, privileges, tool interactions, and metadata reporting.

Changes: Database-Level Read-Only Mode

Layer / File(s) Summary
SQL controls and transition behavior
TOC.md, database-read-only.md, sql-statements/sql-statement-alter-database.md, sql-statements/sql-statement-show-create-database.md
Documents how to enable, check, and disable database-level read-only mode. Covers transaction behavior and the read-only setting in SHOW CREATE DATABASE output.
Restrictions and privilege behavior
database-read-only.md, privilege-management.md, system-variables.md
Documents SQL restrictions, bypass privilege requirements, cluster-wide read-only restrictions, batch-DML behavior, and interactions with TiDB tools.
Metadata and documentation navigation
information-schema/information-schema-schemata-extensions.md, information-schema/information-schema.md, TOC.md, database-read-only.md
Documents SCHEMATA_EXTENSIONS, its OPTIONS values, an example, and related navigation links.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: qiancai, doc-claw-bot, lilin90

Merge Risk: Low · previous review e6e53

The new read-only mode documentation is mostly complete. Before publishing, state the first supported release and qualify the PITR statement for existing target databases, so readers do not rely on read-only protection that may not be present.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the primary change: documentation for database-level read-only mode. The changeset adds a feature guide for that mode and updates related references, so the title matches the main cha…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The PR description follows the repository template. It fills in the required 'What is changed, added, or deleted?' section with a clear list of documentation changes and the reason for them. It also f…
Full details: Title check

Explanation

The title states the primary change: documentation for database-level read-only mode. The changeset adds a feature guide for that mode and updates related references, so the title matches the main change.

Full details: Description check

Explanation

The PR description follows the repository template. It fills in the required 'What is changed, added, or deleted?' section with a clear list of documentation changes and the reason for them. It also fills in the version checklist (master and v8.5), lists related code PRs and a reference link, and records the AI agent involvement checkbox. The author reports validation results. The description leaves out the first-time contributor checklist, which is optional for this check. The 'This PR is translated from' field is blank, which is acceptable because the PR is not a translation. The description is complete and specific enough for reviewers.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: pingcap/docs
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: 4e25f10
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 61ce743d-c0bf-4346-9952-24a92ae15c90
Commits

Reviewing files that changed from the base of the PR and between 4e25f10 and 0ddb06f.

Files selected for processing: 8

  • TOC.md
  • database-read-only.md
  • information-schema/information-schema-schemata-extensions.md
  • information-schema/information-schema.md
  • privilege-management.md
  • sql-statements/sql-statement-alter-database.md
  • sql-statements/sql-statement-show-create-database.md
  • system-variables.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread database-read-only.md Resolved
Comment thread database-read-only.md Resolved
@expxiaoli

Copy link
Copy Markdown
Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: pingcap/docs
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: 4e25f10
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 5cff8c94-4352-4c3c-9cf4-f8e4b9d0e896
Commits

Reviewing files that changed from the base of the PR and between 4e25f10 and 0ddb06f.

Files selected for processing: 8

  • TOC.md
  • database-read-only.md
  • information-schema/information-schema-schemata-extensions.md
  • information-schema/information-schema.md
  • privilege-management.md
  • sql-statements/sql-statement-alter-database.md
  • sql-statements/sql-statement-show-create-database.md
  • system-variables.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread TOC.md Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: pingcap/docs
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: 4e25f10
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 4e3c9a8f-9597-4031-a6be-4dce4ca7f3e8
Commits

Reviewing files that changed from the base of the PR and between 0ddb06f and f59a816.

Files selected for processing: 1

  • database-read-only.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread database-read-only.md Resolved
Comment thread database-read-only.md Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: pingcap/docs
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: 4e25f10
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: fcf3987b-ba85-4dcd-ae3c-7c51d85042f9
Commits

Reviewing files that changed from the base of the PR and between f59a816 and e6e53b6.

Files selected for processing: 1

  • database-read-only.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Comment thread database-read-only.md Resolved

@wjhuang2016 wjhuang2016 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I checked the read-only transition and rollback, privilege enforcement, SCHEMATA_EXTENSIONS output, batch DML, and restore behavior against the merged TiDB implementation and its tests. The Markdown, links, and anchors passed CI.

One P2 remains for the release-8.5 documentation: the guide promises SQL restoration of sequences into read-only databases while the required fix is still open. The table should condition that behavior on a release that includes the fix.

Comment thread database-read-only.md Resolved

@wjhuang2016 wjhuang2016 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-reviewed commit dd8f12a910 and the full PR diff.

The previous P2 on SQL sequence restore versioning for release-8.5 is resolved: database-read-only.md now explicitly states Starting from v8.5.9 and removes the version TODO, and on pingcap/tidb release-8.5 both the database read-only feature (pingcap/tidb#73575) and the SQL sequence restore fix (pingcap/tidb#73801) are merged after v8.5.8, so they ship together in v8.5.9 without needing a separate version caveat.

All other files in the PR are unchanged since the prior technical verification against the TiDB implementation, and all docs CI checks (vale, linkChecker, and internal link/TOC/anchor checks) pass on dd8f12a910.

@ti-chi-bot

ti-chi-bot Bot commented Dec 4, 2026

Copy link
Copy Markdown

@wjhuang2016: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

Re-reviewed commit dd8f12a910 and the full PR diff.

The previous P2 on SQL sequence restore versioning for release-8.5 is resolved: database-read-only.md now explicitly states Starting from v8.5.9 and removes the version TODO, and on pingcap/tidb release-8.5 both the database read-only feature (pingcap/tidb#73575) and the SQL sequence restore fix (pingcap/tidb#73801) are merged after v8.5.8, so they ship together in v8.5.9 without needing a separate version caveat.

All other files in the PR are unchanged since the prior technical verification against the TiDB implementation, and all docs CI checks (vale, linkChecker, and internal link/TOC/anchor checks) pass on dd8f12a910.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. missing-translation-status This PR does not have translation status info. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants