Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

br: add unrecoverable system tables list #20145

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion br/br-snapshot-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ tiup br restore full \

### Restore tables in the `mysql` schema

When the cluster is in snapshot backup, BR backs up system tables as tables with the database name prefix with `__TiDB_BR_Temporary`. For example, the table `mysql.user` will be backed up as `__TiDB_BR_Temporary_mysql.user`.

When the cluster is in snapshot restore, BR at first restores tables with the database name prefix with `__TiDB_BR_Temporary`, in order to avoid conflicts with existing system tables in the cluster. Then when BR starts to restore the system tables, it inserts the data from tables with the database name prefix with `__TiDB_BR_Temporary` to the corresponding system tables through the `REPLACE INTO` SQL.

- Starting from BR v5.1.0, when you back up snapshots, BR automatically backs up the **system tables** in the `mysql` schema, but does not restore these system tables by default.
- Starting from v6.2.0, BR lets you specify `--with-sys-table` to restore **data in some system tables**.
- Starting from v7.6.0, BR enables `--with-sys-table` by default, which means that BR restores **data in some system tables** by default.
Expand All @@ -153,15 +157,24 @@ tiup br restore full \

- Statistics tables (`mysql.stat_*`). But statistics can be restored. See [Back up statistics](/br/br-snapshot-manual.md#back-up-statistics).
- System variable tables (`mysql.tidb` and `mysql.global_variables`)
- [Other system tables](https://github.com/pingcap/tidb/blob/master/br/pkg/restore/snap_client/systable_restore.go#L31)
- [Other system tables](https://github.com/pingcap/tidb/blob/master/br/pkg/restore/snap_client/systable_restore.go#L66)

```
+-----------------------------------------------------+
| advisory_locks |
| analyze_jobs |
| analyze_options |
| capture_plan_baselines_blacklist |
| column_stats_usage |
| dist_framework_meta |
| gc_delete_range |
| gc_delete_range_done |
| global_variables |
| help_topic |
| index_advisor_results |
| plan_replayer_status |
| plan_replayer_task |
| request_unit_by_group |
| stats_buckets |
| stats_extended |
| stats_feedback |
Expand All @@ -172,7 +185,27 @@ tiup br restore full \
| stats_meta_history |
| stats_table_locked |
| stats_top_n |
| table_cache_meta |
| tidb |
| tidb_background_subtask |
| tidb_background_subtask_history |
| tidb_ddl_history |
| tidb_ddl_job |
| tidb_ddl_notifier |
| tidb_ddl_reorg |
| tidb_global_task |
| tidb_global_task_history |
| tidb_import_jobs |
| tidb_mdl_info |
| tidb_mdl_view |
| tidb_pitr_id_map |
| tidb_runaway_queries |
| tidb_runaway_watch |
| tidb_runaway_watch_done |
| tidb_timers |
| tidb_ttl_job_history |
| tidb_ttl_table_status |
| tidb_ttl_task |
+-----------------------------------------------------+
```

Expand Down
2 changes: 1 addition & 1 deletion faq/backup-and-restore-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Note that even if you configures [table filter](/table-filter.md#syntax), **BR d

- Statistics tables (`mysql.stat_*`). But statistics can be restored. See [Back up statistics](/br/br-snapshot-manual.md#back-up-statistics).
- System variable tables (`mysql.tidb`, `mysql.global_variables`)
- [Other system tables](https://github.com/pingcap/tidb/blob/master/br/pkg/restore/snap_client/systable_restore.go#L31)
- [Other system tables](https://github.com/pingcap/tidb/blob/master/br/pkg/restore/snap_client/systable_restore.go#L66)

### How to deal with the error of `cannot find rewrite rule` during restoration?

Expand Down