pingcap/tidb

DDL command DROP TABLE is not atomic

Open

#29.147 geöffnet am 26. Okt. 2021

Auf GitHub ansehen
 (4 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Go (6.186 Forks)batch import
help wantedseverity/moderatesig/sql-infratype/bugtype/compatibility

Repository-Metriken

Stars
 (40.090 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 14T 4h) (346 gemergte PRs in 30 T)

Beschreibung

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT);
DROP TABLE t1, t1; -- MySQL ( error 1066 did not drop table) vs TiDB error  ( error 1051 dropped table)
SHOW TABLES LIKE 't1'; -- MySQL shows table existing vs. TiDB shows no table

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

In both MySQL 5.7 and 8.0:

mysql [localhost:5731] {msandbox} (test) > DROP TABLE IF EXISTS t1;
Query OK, 0 rows affected (0.00 sec)

mysql [localhost:5731] {msandbox} (test) > CREATE TABLE t1 (a INT);
Query OK, 0 rows affected (0.01 sec)

mysql [localhost:5731] {msandbox} (test) > DROP TABLE t1, t1; -- MySQL ( error 1066 did not drop table) vs TiDB error  ( error 1051 dropped table)
ERROR 1066 (42000): Not unique table/alias: 't1'
mysql [localhost:5731] {msandbox} (test) > SHOW TABLES LIKE 't1'; -- MySQL shows table existing vs. TiDB shows no table
+---------------------+
| Tables_in_test (t1) |
+---------------------+
| t1                  |
+---------------------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

tidb> DROP TABLE IF EXISTS t1;
Query OK, 0 rows affected (0.01 sec)

tidb> CREATE TABLE t1 (a INT);
Query OK, 0 rows affected (0.00 sec)

tidb> DROP TABLE t1, t1; -- MySQL ( error 1066 did not drop table) vs TiDB error  ( error 1051 dropped table)
ERROR 1051 (42S02): Unknown table 'test.t1'
tidb> SHOW TABLES LIKE 't1'; -- MySQL shows table existing vs. TiDB shows no table
Empty set (0.00 sec)

4. What is your TiDB version? (Required)

+-------------------------+--------------------------------------------------------------------------+
| Variable_name           | Value                                                                    |
+-------------------------+--------------------------------------------------------------------------+
| innodb_version          | 5.6.25                                                                   |
| protocol_version        | 10                                                                       |
| tidb_analyze_version    | 2                                                                        |
| tidb_row_format_version | 2                                                                        |
| tls_version             | TLSv1,TLSv1.1,TLSv1.2                                                    |
| version                 | 5.7.25-TiDB-v5.2.1                                                       |
| version_comment         | TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible |
| version_compile_machine | x86_64                                                                   |
| version_compile_os      | osx10.8                                                                  |
+-------------------------+--------------------------------------------------------------------------+

Contributor Guide