Skip to content

br: clarify how statistics backup and restore are controlled - #24705

Open
doc-claw-bot wants to merge 1 commit into
pingcap:masterfrom
doc-claw-bot:docs/br-stats-flags-clarify
Open

doc-claw-bot wants to merge 1 commit into
pingcap:masterfrom
doc-claw-bot:docs/br-stats-flags-clarify

Conversation

@doc-claw-bot

@doc-claw-bot doc-claw-bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

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

Clarify that BR statistics backup and restore are controlled separately from --with-sys-table.

  • Clarify in br/br-snapshot-manual.md that --with-sys-table restores selected system-table data such as privilege data and SQL bindings, while statistics are backed up only when --ignore-stats=false and restored according to --load-stats.
  • Replace the incorrect wildcard mysql.stat_* with mysql.stats_*.
  • Align the same clarification in br/br-snapshot-guide.md and faq/backup-and-restore-faq.md to keep the BR docs consistent.

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
    • Clarified how backup and restore options control statistics, separately from system-table data such as account permissions and SQL bindings.
    • Updated the documented statistics-table name pattern and specified which system tables are not restored with --with-sys-table.

@ti-chi-bot ti-chi-bot Bot added contribution This PR is from a community contributor. missing-translation-status This PR does not have translation status info. labels Nov 17, 2026
@ti-chi-bot

ti-chi-bot Bot commented Nov 17, 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 lilin90 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 the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The BR snapshot guide, manual, and backup-and-restore FAQ update the statistics-table pattern and clarify that backup and restore use separate controls.

Changes: Statistics backup and restore documentation

Layer / File(s) Summary
Document statistics backup and restore controls
br/br-snapshot-guide.md, br/br-snapshot-manual.md, faq/backup-and-restore-faq.md
The documents identify statistics tables as mysql.stats_*. They state that BR backs up statistics only when --ignore-stats=false and restores them according to --load-stats. The manual also clarifies that --with-sys-table does not restore these statistics tables, mysql.tidb, or mysql.global_variables.

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other

Suggested reviewers: hfxsd, qiancai

Merge Risk: Low · up to 3e71b

The documentation clarification is accurate for the current branch. The guide and FAQ lists still say BR never restores statistics tables, without noting that --fast-load-sys-tables can restore them physically on an eligible restore. Readers could be misled, but nothing breaks, and the fix is a small wording change. The v7.5 backport needs its own version qualifier for --load-stats.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: clarifying how BR statistics backup and restore are controlled. The changeset updates the BR snapshot manual, guide, and FAQ to describe the --ignore-stats and --load-…
Description check Passed The description fills the required sections: it states what changed and why, lists the affected files, and ticks the target versions (master, v8.5, v8.1, v7.5). It also includes a reference link and t…
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.
Full details: Title check

Explanation

The title names the main change: clarifying how BR statistics backup and restore are controlled. The changeset updates the BR snapshot manual, guide, and FAQ to describe the --ignore-stats and --load-stats controls for statistics and to fix mysql.stat_* to mysql.stats_*. The title is specific and matches the primary change.

Full details: Description check

Explanation

The description fills the required sections: it states what changed and why, lists the affected files, and ticks the target versions (master, v8.5, v8.1, v7.5). It also includes a reference link and the AI agent involvement checkbox. The template's CLA checkbox is not ticked and the first-time contributor section is left as template text. The 'What is the related PR or file link(s)' section has no code PR link, which is acceptable because the change is docs-only. The description is mostly complete.

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

@doc-claw-bot doc-claw-bot added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. type/bugfix This PR fixes a bug. area/br Indicates that the Issue or PR belongs to the area of BR (Backup & Restore). ONCALL Relates to documentation oncall. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. requires-version-specific-changes After cherry-picked, the cherry-picked PR requires further changes. and removed missing-translation-status This PR does not have translation status info. labels Nov 17, 2026

@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: db26e52
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 78847ca7-3811-41ed-983b-6e81d2b31b82
Commits

Reviewing files that changed from the base of the PR and between db26e52 and 3e71bc6.

Files selected for processing: 3

  • br/br-snapshot-guide.md
  • br/br-snapshot-manual.md
  • faq/backup-and-restore-faq.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 br/br-snapshot-guide.md
**BR does not restore the following system tables:**

- Statistics tables (`mysql.stat_*`). But statistics can be restored. See [Back up statistics](/br/br-snapshot-manual.md#back-up-statistics).
- Statistics tables (`mysql.stats_*`). However, statistics can still be restored separately. BR backs up statistics only when `--ignore-stats=false` and restores them according to `--load-stats`. See [Back up statistics](/br/br-snapshot-manual.md#back-up-statistics).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Scope the statistics-table exclusion to the logical restore path.

The "BR does not restore" list states that statistics tables are never restored. The guide and manual also say that --fast-load-sys-tables restores them physically on an eligible restore to a new cluster. Add that condition to the list item, and keep the separate-restore note.

The FAQ list at faq/backup-and-restore-faq.md:285 has the same unqualified statement. Apply the same wording there.

Suggested wording for br/br-snapshot-guide.md

--- "a/br/br-snapshot-guide.md"
+++ "b/br/br-snapshot-guide.md"
@@ -173,7 +173,7 @@
 
 **BR does not restore the following system tables:**
 
-- Statistics tables (`mysql.stats_*`). However, statistics can still be restored separately. BR backs up statistics only when `--ignore-stats=false` and restores them according to `--load-stats`. See [Back up statistics](/br/br-snapshot-manual.md#back-up-statistics).
+- Statistics tables (`mysql.stats_*`), unless `--fast-load-sys-tables` restores them physically on an eligible restore to a new cluster. Statistics can also be restored separately: BR backs up statistics only when `--ignore-stats=false` and restores them according to `--load-stats`. See [Back up statistics](/br/br-snapshot-manual.md#back-up-statistics).
 - System variable tables (`mysql.tidb` and `mysql.global_variables`)
 - Other system tables
 
Committable suggestion

IMPORTANT
Review the replacement and indentation, then test before committing.

Suggested change
- Statistics tables (`mysql.stats_*`). However, statistics can still be restored separately. BR backs up statistics only when `--ignore-stats=false` and restores them according to `--load-stats`. See [Back up statistics](/br/br-snapshot-manual.md#back-up-statistics).
- Statistics tables (`mysql.stats_*`), unless `--fast-load-sys-tables` restores them physically on an eligible restore to a new cluster. Statistics can also be restored separately: BR backs up statistics only when `--ignore-stats=false` and restores them according to `--load-stats`. See [Back up statistics](/br/br-snapshot-manual.md#back-up-statistics).

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

Labels

area/br Indicates that the Issue or PR belongs to the area of BR (Backup & Restore). contribution This PR is from a community contributor. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. ONCALL Relates to documentation oncall. requires-version-specific-changes After cherry-picked, the cherry-picked PR requires further changes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. type/bugfix This PR fixes a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant