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

BACKUP sql command does not verify schema exists #18301

Open
wwar opened this issue Jun 30, 2020 · 1 comment
Open

BACKUP sql command does not verify schema exists #18301

wwar opened this issue Jun 30, 2020 · 1 comment
Assignees
Labels
component/br This issue is related to BR of TiDB. severity/moderate type/bug The issue is confirmed as a bug.

Comments

@wwar
Copy link

wwar commented Jun 30, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| METRICS_SCHEMA     |
| PERFORMANCE_SCHEMA |
| mysql              |
| test               |
+--------------------+
5 rows in set (0.00 sec)

mysql> BACKUP DATABASE `abc123` TO 'local:///tmp/';
+---------------+------+--------------------+---------------------+---------------------+
| Destination   | Size | BackupTS           | Queue Time          | Execution Time      |
+---------------+------+--------------------+---------------------+---------------------+
| local:///tmp/ |    0 | 417741498863583234 | 2020-06-30 16:49:13 | 2020-06-30 16:49:13 |
+---------------+------+--------------------+---------------------+---------------------+
1 row in set (0.01 sec)

mysql> RESTORE DATABASE `abc123` FROM 'local:///tmp/';
+---------------+------+----------+---------------------+---------------------+
| Destination   | Size | BackupTS | Queue Time          | Execution Time      |
+---------------+------+----------+---------------------+---------------------+
| local:///tmp/ |    6 |        0 | 2020-06-30 16:54:50 | 2020-06-30 16:54:50 |
+---------------+------+----------+---------------------+---------------------+
1 row in set (0.00 sec)

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| METRICS_SCHEMA     |
| PERFORMANCE_SCHEMA |
| mysql              |
| test               |
+--------------------+
5 rows in set (0.00 sec)

2. What did you expect to see? (Required)

It should provide an error, since this could lead to a case where a typo causes a backup not to be generated.

3. What did you see instead (Required)

Statement succeeds:

mysql> BACKUP DATABASE `abc123` TO 'local:///tmp/';
+---------------+------+--------------------+---------------------+---------------------+
| Destination   | Size | BackupTS           | Queue Time          | Execution Time      |
+---------------+------+--------------------+---------------------+---------------------+
| local:///tmp/ |    0 | 417741498863583234 | 2020-06-30 16:49:13 | 2020-06-30 16:49:13 |
+---------------+------+--------------------+---------------------+---------------------+
1 row in set (0.01 sec)

4. Affected version (Required)

mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-688-g28cc5e6ff
Edition: Community
Git Commit Hash: 28cc5e6ff7f9fe1d7b989b238a12aff62280682d
Git Branch: master
UTC Build Time: 2020-06-28 02:04:29
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)

5. Root Cause Analysis

@wwar wwar added the type/bug The issue is confirmed as a bug. label Jun 30, 2020
@zz-jason
Copy link
Member

zz-jason commented Jul 1, 2020

@kennytm PTAL

@ghost ghost added the component/tools label Aug 7, 2020
@jebter jebter added component/br This issue is related to BR of TiDB. and removed component/tools labels Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/br This issue is related to BR of TiDB. severity/moderate type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

5 participants