pingcap / pingcap/tidb

DDL isolation level incompatible with mysql

Open
#45,959 3 comments 0 reactions 0 assignees View on GitHub
type/feature-request
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Feature Request
DDL isolation level is compatible with mysql, when tidb enable transactions and cannot view the latest version of the table, but mysql can read the latest version of ddl. And if you delete a table and create a new one with the same table name, it shows that the transaction will read the old table structure.
**Is your feature request related to a problem? Please describe:**

TiDB:
```
mysql> create table test(id int,name int);

mysql> show variables like '%iso%';
+---------------------------------+-------------------+
| Variable_name | Value |
+---------------------------------+-------------------+
| tidb_isolation_read_engines | tikv,tiflash,tidb |
| tidb_skip_isolation_level_check | OFF |
| transaction_isolation | READ-COMMITTED |
| tx_isolation | READ-COMMITTED |
| tx_isolation_one_shot | |
+---------------------------------+-------------------+
5 rows in set (0.00 sec)

session1:
mysql> begin;
Query OK, 0 rows affected (0.00 sec)

session2:
mysql> alter table test rename to test10;
Query OK, 0 rows affected (0.13 sec)

session1:
mysql> select * from test;
ERROR 1146 (42S02): Table 'test.test' doesnt exist

session2:
mysql> create table test(id int,name int,name1 int);
Query OK, 0 rows affected (0.12 sec)

session1:
mysql> desc test;
+-------+---------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+------+---------+-------+
| id | int(11) | YES | | NULL | |
| name | int(11) | YES | | NULL | |
+-------+---------+------+------+---------+-------+
2 rows in set (0.01 sec)
mysql> select * from test;
Empty set (0.00 sec)
```
MySQL 8.0:
```
session1:
mysql> begin;
Query OK, 0 rows affected (0.00 sec)

session2:
mysql> alter table test rename to test10;
Query OK, 0 rows affected (0.13 sec)

session1:
mysql> select * from test;
ERROR 1146 (42S02): Table 'test.test' doesnt exist

session2:
mysql> create table test(id int,name int,name1 int);
Query OK, 0 rows affected (0.12 sec)

session1:
mysql> desc test;
+-------+---------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+------+---------+-------+
| id | int(11) | YES | | NULL | |
| name | int(11) | YES | | NULL | |
| name1 | int(11) | YES | | NULL | |
+-------+---------+------+------+---------+-------+
2 rows in set (0.01 sec)
mysql> select * from test;
Empty set (0.00 sec)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.