Can't execute the query because you have a conflicting read lock

mysql> create table t (id int(10) );

ERROR 1223 (HY000): Can't execute the query because you have a conflicting read lock



mysql> select id,user,host,command,time,state from information_schema.processlist;
+----+---------+---------------------+-------------+------+------------------------------------------------------------------+
| id | user    | host                   | command     | time | state                                                            |
+----+---------+---------------------+-------------+------+------------------------------------------------------------------+
|  9 | root    | localhost            | Sleep        |  516 |                                                                  |
| 17 | root    | localhost           | Query       |  952 | Waiting for global read lock                                     |
| 22 | root    | localhost           | Query       |    0 | executing                                                        |
+----+---------+---------------------+-------------+------+------------------------------------------------------------------+
3 rows in set (0.00 sec)


global read lock  是怎麼產生的?

那個線程產生的呢?


一般global read lock 有 flush table with read lock; 產生。因此只要UNLOCK TABLES 就可以了。

要定位那個thread 持有這個鎖,可能需要藉助gdb了。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章