确保数据的一致性,在有其他事务使用表的情况下,对该表的DDL操作都应该阻塞,from 5.5.3

step1——

session1:

  1. mysql> begin;
  2. Query OK, 0 rows affected (0.00 sec)
  3. mysql> select * from t1;
  4. +------+
  5. | f1 |
  6. +------+
  7. | 100 |
  8. +------+
  9. 1 row in set (0.00 sec)

session2

mysql> drop table t1;


~output 挂起状态

step2——
session1:

mysql> rollback;
Query OK, 0 rows affected (0.00 sec)

session2:

mysql> drop table t1;
Query OK, 0 rows affected (25.17 sec)