From e979e9dbb756b5de8ce63d649174b7a1f96fe521 Mon Sep 17 00:00:00 2001 From: IANTHEREAL Date: Fri, 30 Jul 2021 09:38:50 +0800 Subject: [PATCH 1/2] update out-of-date document --- br/backup-and-restore-tool.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/br/backup-and-restore-tool.md b/br/backup-and-restore-tool.md index 3faf6f4af668d..38e57d4b6b691 100644 --- a/br/backup-and-restore-tool.md +++ b/br/backup-and-restore-tool.md @@ -151,17 +151,20 @@ Note that skipping the version check might introduce incompatibility. The versio | Use BR v4.0 to back up TiDB v4.0 | ✅ | ✅ | ✅ (If TiKV >= v4.0.0-rc.1, and if BR contains the [#233](https://github.com/pingcap/br/pull/233) bug fix and TiKV does not contain the [#7241](https://github.com/tikv/tikv/pull/7241) bug fix, BR will cause the TiKV node to restart.) | | Use BR nightly or v5.0 to back up TiDB v4.0 | ❌ (If the TiDB version is earlier than v4.0.9, the [#609](https://github.com/pingcap/br/issues/609) issue might occur.) | ❌ (If the TiDB version is earlier than v4.0.9, the [#609](https://github.com/pingcap/br/issues/609) issue might occur.) | ❌ (If the TiDB version is earlier than v4.0.9, the [#609](https://github.com/pingcap/br/issues/609) issue might occur.) | -### Backup and restore system schemas +### Backup and restore data under system schema `mysql` (experimental feature) -Before v5.1.0, BR filtered out data from the system schemas during the backup. +> **Warning:** +> +> This feature is experimental and not thoroughly tested. It is highly **not recommended** to use this feature in the production environment. + +Before v5.1.0, BR filtered out data from the system schema `mysql` during the backup. Since v5.1.0, BR **backups** all data by default, including the system schema (`mysql.*`). But the technical implementation of restoring system table (`mysql.*`) is not complete yet, the tables in system schema `mysql` are **not** restored by default during the **restore**. -Since v5.1.0, BR **backups** all data by default, including the system schema (`mysql.*`). But to be compatible with the earlier versions of BR, the tables in system schema are **not** restored by default during the **restore**. If you want the tables to be restored to the system schemas, you need to set the [`filter` parameter](/br/use-br-command-line-tool.md#back-up-with-table-filter). Then, the system tables are first restored to the temporary schemas and then to the system schemas (by renaming the temporary schemas). +If you want the tables to be restored to the system schema `mysql`, you can set the [`filter` parameter](/br/use-br-command-line-tool.md#back-up-with-table-filter) - restore the corresponding table by *filtering the table name (-f "mysql.usertable1")*. Then, the system table are first restored to the temporary schemas and then renamed to the system schema. -In addition, TiDB performs special operations on the following system tables: +It should be noted that the following system tables cannot be restored correctly due to technical reasons. Even if -f `mysql.*` is specified, the following tables will not be restored: -- Tables related to statistical information are not restored, because the table ID of the statistical information has changed. -- `tidb` and `global_variables` tables in the `mysql` schema are not restored, because these tables cannot be overwritten. For example, overwriting these tables by the GC safepoint will affect the cluster. -- The restore of the `user` table in the `mysql` schema does not take effect until you manually execute the `FLUSH PRIVILEGE` command. +- Tables related to statistics: "stats_buckets", "stats_extended", "stats_feedback", "stats_fm_sketch", "stats_histograms", "stats_meta", "stats_top_n" +- Privileges or system-related tables: "tidb", "global_variables", "columns_priv", "db", "default_roles", "global_grants", "global_priv", "role_edges", "tables_priv", "user", "gc_delete_range", "Gc_delete_range_done", "schema_index_usage" ### Minimum machine configuration required for running BR From f4e0cd9288aa7e72dd3b5bcc30dae137cb1ea3ff Mon Sep 17 00:00:00 2001 From: Ian Date: Fri, 30 Jul 2021 12:10:46 +0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- br/backup-and-restore-tool.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/br/backup-and-restore-tool.md b/br/backup-and-restore-tool.md index 38e57d4b6b691..de6050f8e64ea 100644 --- a/br/backup-and-restore-tool.md +++ b/br/backup-and-restore-tool.md @@ -151,20 +151,20 @@ Note that skipping the version check might introduce incompatibility. The versio | Use BR v4.0 to back up TiDB v4.0 | ✅ | ✅ | ✅ (If TiKV >= v4.0.0-rc.1, and if BR contains the [#233](https://github.com/pingcap/br/pull/233) bug fix and TiKV does not contain the [#7241](https://github.com/tikv/tikv/pull/7241) bug fix, BR will cause the TiKV node to restart.) | | Use BR nightly or v5.0 to back up TiDB v4.0 | ❌ (If the TiDB version is earlier than v4.0.9, the [#609](https://github.com/pingcap/br/issues/609) issue might occur.) | ❌ (If the TiDB version is earlier than v4.0.9, the [#609](https://github.com/pingcap/br/issues/609) issue might occur.) | ❌ (If the TiDB version is earlier than v4.0.9, the [#609](https://github.com/pingcap/br/issues/609) issue might occur.) | -### Backup and restore data under system schema `mysql` (experimental feature) +### Back up and restore table data in the `mysql` system schema (experimental feature) > **Warning:** > > This feature is experimental and not thoroughly tested. It is highly **not recommended** to use this feature in the production environment. -Before v5.1.0, BR filtered out data from the system schema `mysql` during the backup. Since v5.1.0, BR **backups** all data by default, including the system schema (`mysql.*`). But the technical implementation of restoring system table (`mysql.*`) is not complete yet, the tables in system schema `mysql` are **not** restored by default during the **restore**. +Before v5.1.0, BR filtered out data from the system schema `mysql` during the backup. Since v5.1.0, BR **backs up** all data by default, including the system schemas `mysql.*`. But the technical implementation of restoring the system tables in `mysql.*` is not complete yet, so the tables in the system schema `mysql` are **not** restored by default. -If you want the tables to be restored to the system schema `mysql`, you can set the [`filter` parameter](/br/use-br-command-line-tool.md#back-up-with-table-filter) - restore the corresponding table by *filtering the table name (-f "mysql.usertable1")*. Then, the system table are first restored to the temporary schemas and then renamed to the system schema. +If you want the data of a system table (for example, `mysql.usertable1`) to be restored to the system schema `mysql`, you can set the [`filter` parameter](/br/use-br-command-line-tool.md#back-up-with-table-filter) to filter the table name (`-f "mysql.usertable1"`). After the setting, the system table is first restored to the temporary schema, and then to the system schema through renaming. -It should be noted that the following system tables cannot be restored correctly due to technical reasons. Even if -f `mysql.*` is specified, the following tables will not be restored: +It should be noted that the following system tables cannot be restored correctly due to technical reasons. Even if `-f "mysql.*"` is specified, these tables will not be restored: - Tables related to statistics: "stats_buckets", "stats_extended", "stats_feedback", "stats_fm_sketch", "stats_histograms", "stats_meta", "stats_top_n" -- Privileges or system-related tables: "tidb", "global_variables", "columns_priv", "db", "default_roles", "global_grants", "global_priv", "role_edges", "tables_priv", "user", "gc_delete_range", "Gc_delete_range_done", "schema_index_usage" +- Tables related to privileges or the system: "tidb", "global_variables", "columns_priv", "db", "default_roles", "global_grants", "global_priv", "role_edges", "tables_priv", "user", "gc_delete_range", "Gc_delete_range_done", "schema_index_usage" ### Minimum machine configuration required for running BR