【环境介绍】
系统环境:Linux + mysql 5.7.18 + 主从复制架构
【背景描述】
客户反映用在mysql数据库上truncate一个innode引擎的list分区100G左右表时,耗时时间非常久,执行命令期间数据库运行非常缓慢,新连接无法登录,连旧连接都是卡主。
【问题处理】
数据库后台日志信息:
2018-04-17T07:01:50.963763Z 0 [Warning] InnoDB: A long semaphore wait:
--Thread 139922526992128 has waited at btr0sea.ic line 90 for 241.00 seconds the semaphore:
X-lock (wait_ex) on RW-latch at 0xa49e6a08 created in fileline 195
a writer (thread id 139922526992128) has reserved it in mode wait exclusive
number of readers 1, waiters flag 1, lock_word: ffffffffffffffff
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /export/home/pb2/build/sb_0-22759043-1489826356.96/mysql-5.7.18/storage/innobase/btr/line 3874
InnoDB: ###### Starts InnoDB Monitor for 30 secs to print diagnostic info:
InnoDB: