对于带有mysql-5.6.23的innodb表,我面临一个奇怪的问题,我在master-master设置中配置了两个数据库实例,所有实时流量一次由一个实例提供服务,突然一个特定的innodb表停止执行DML,并且所有引用该表的查询都会被卡住。以下是表大小和innodb配置参数的详细信息
Table details
12K ERP_INSERT.frm
325M ERP_INSERT.ibd
Innodb Config Parameters
innodb_data_home_dir = /usr/local/mysql6/data
innodb_data_file_path = ibdata1:100M:autoextend
innodb_buffer_pool_instances = 40
innodb_buffer_pool_size = 40G
innodb_log_file_size = 512M
innodb_log_buffer_size = 16M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 100
innodb_file_per_table
innodb_flush_method=O_DIRECT
我曾尝试使用解锁表,刷新表但锁定表不会被释放,最后我重新启动MySQL实例以删除此锁。 请帮我找出造成这个问题的原因以及如何减轻这个问题。
show engine innodb status的片段
---TRANSACTION 21674675426, ACTIVE 0 sec
3 lock struct(s), heap size 360, 1 row lock(s), undo log entries 3
MySQL thread id 12733500, OS thread handle 0x7f6d0ad35700, query id 1411990346 172.10.17.60 99user cleaning up
Trx read view will not see trx with id >= 21674675430, sees < 21663148509
---TRANSACTION 21674609895, ACTIVE 46 sec inserting
mysql tables in use 1, locked 1
LOCK WAIT 39 lock struct(s), heap size 6544, 26 row lock(s), undo log entries 19
MySQL thread id 12728923, OS thread handle 0x7f6d67924700, query id 1411781698 172.10.17.65 99user update
insert into navintegration.ERP_INSERT (STATUS, USER_HOST , DB_NAME , TABLE_NAME , PKEY_NAME ,PKEY_INDEX , DATE_TIME ) values ('N','ERP','property','PROFILE','PROFILEID','2846937','2016-01-15 17:18:44')
Trx read view will not see trx with id >= 21674609896, sees < 21663148509
------- TRX HAS BEEN WAITING 46 SEC FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 117 page no 18348 n bits 544 index `PKEY_INDEX` of table `navintegration`.`ERP_INSERT` trx id 21674609895 lock_mode X locks gap before rec insert intention waiting
Record lock, heap no 235 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
0: len 6; hex 323834363936; asc 284696;;
1: len 4; hex 007f1837; asc 7;;