Skip to content

Commit

Permalink
br: add restore to systables (#6004)
Browse files Browse the repository at this point in the history
* br: add restore to systables

* Apply suggestions from code review

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
  • Loading branch information
Liuxiaozhen12 and TomShawn authored Aug 26, 2021
1 parent 74dd11c commit 293df6e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions br/use-br-command-line-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,39 @@ In the above command, `--table` specifies the name of the table to be restored.
Restoring incremental data is similar to [restoring full data using BR](#restore-all-the-backup-data). Note that when restoring incremental data, make sure that all the data backed up before `last backup ts` has been restored to the target cluster.
### Restore tables created in the `mysql` schema (experimental feature)
BR backs up tables created in the `mysql` schema by default.
When you restore data using BR, the tables created in the `mysql` schema are not restored by default. If you need to restore these tables, you can explicitly include them using the [table filter](/table-filter.md#syntax). The following example restores `mysql.usertable` created in `mysql` schema. The command restores `mysql.usertable` along with other data.
{{< copyable "shell-regular" >}}
```shell
br restore full -f '*.*' -f '!mysql.*' -f 'mysql.usertable' -s $external_storage_url
```
In the above command, `-f '*.*'` is used to override the default rules and `-f '!mysql.*'` instructs BR not to restore tables in `mysql` unless otherwise stated. `-f 'mysql.usertable'` indicates that `mysql.usertable` is required for restore. For detailed implementation, refer to the [table filter document](/table-filter.md#syntax).
If you only need to restore `mysql.usertable`, use the following command:
{{< copyable "shell-regular" >}}
```shell
br restore full -f 'mysql.usertable' -s $external_storage_url
```
> **Warning:**
>
> Although you can back up and restore system tables (such as `mysql.tidb`) using the BR tool, some unexpected situations might occur after the restore, including:
>
> - the statistical information tables (`mysql.stat_*`) cannot be restored.
> - the system variable tables (`mysql.tidb`,`mysql.global_variables`) cannot be restored.
> - the user information tables (such as `mysql.user` and `mysql.columns_priv`) cannot be restored.
> - GC data cannot be restored.
>
> Restoring system tables might cause more compatibility issues. To avoid unexpected issues, **DO NOT** restore system tables in the production environment.
### Restore Raw KV (experimental feature)
> **Warning:**
Expand Down

0 comments on commit 293df6e

Please sign in to comment.