我用写锁锁定了 3 个 innodb 表
lock tables hive.NEXT_COMPACTION_QUEUE_ID write;
lock tables hive.NEXT_LOCK_ID write;
lock tables hive.NEXT_TXN_ID write;
我通过SQL查到哪个表被锁了
SHOW OPEN TABLES WHERE `Database` LIKE 'hive' AND In_use > 0;
但只有一张桌子(我锁定的最后一张桌子),为什么?
+--------------------+----------------------------------------------+--------+-------------+
| Database | Table | In_use | Name_locked |
+--------------------+----------------------------------------------+--------+-------------+
| hive | NEXT_TXN_ID | 1 | 0 |
但是当我想显示我认为没有锁定的第一张表时,它锁定了!为什么?show open tables 不正确吗?
show create table hive.NEXT_COMPACTION_QUEUE_ID;
ERROR 1100 (HY000): Table 'NEXT_COMPACTION_QUEUE_ID' was not locked with LOCK TABLES