pingcap/tidb

DDL command DROP TABLE is not atomic

Open

#29.147 aperta il 26 ott 2021

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)Go (6186 fork)batch import
help wantedseverity/moderatesig/sql-infratype/bugtype/compatibility

Metriche repository

Star
 (40.090 star)
Metriche merge PR
 (Merge medio 14g 4h) (346 PR mergiate in 30 g)

Descrizione

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                                                                  |
+-------------------------+--------------------------------------------------------------------------+

Guida contributor