本帖最后由 bedrock 于 2022-10-31 11:54 编辑 本地实验 版本:5.7.38 已被锁,假设有几千个会话,未开启ps.metadata_locks,如何快速定位持有FTWRL语句id 注:ps.metadata_locks 默认是被关闭的,当数据库已经被 FTWRL 时 开启语句:UPDATE performance_schema.setup_instruments SET ENABLED = 'YES' WHERE NAME ='wait/lock/metadata/sql/mdl'; 也会被阻塞 会话一 mysql> flush tables with read lock; Query OK, 0 rows affected (0.00 sec) 会话2,被阻塞 mysql> delete from test.limit_test where id=100001; 会话1 mysql> show full processlist\G *************************** 1. row *************************** Id: 1 User: event_scheduler Host: localhost db: NULL Command: Daemon Time: 331949 State: Waiting on empty queue Info: NULL *************************** 2. row *************************** Id: 38 User: root Host: localhost db: test Command: Query Time: 0 State: starting Info: show full processlist *************************** 3. row *************************** Id: 39 User: canal Host: alltest:33512 db: canal_manager Command: Sleep Time: 35 State: Info: NULL *************************** 4. row *************************** Id: 40 User: root Host: localhost db: NULL Command: Query Time: 5 State: Waiting for global read lock Info: delete from test.limit_test where id=100001 4 rows in set (0.00 sec) |
bedrock
2022-10-31 11:49:31
| ||
bedrock
2022-10-31 11:51:31
| ||
yejr
2022-11-1 16:49:01
| ||
合作电话:010-64087828
社区邮箱:greatsql@greatdb.com