数据库中发现:TOO MANY LOCKS PRINTED FOR THIS TRX: SUPPRESSING FURTHER PRINTS
同时R&D同学也抱怨经常锁等待超时。
赶紧去看innodb status 怎么说:
Trx read view will not see trx with id >= 4130470E, sees < 4126FFF2
---TRANSACTION 413041D4, ACTIVE 13 sec
MySQL thread id 1597289, OS thread handle 0x7f29135f5700, query id 1375119614 10.100.2.88 xms_user
Trx read view will not see trx with id >= 413041D5, sees < 4126FFF2
---TRANSACTION 4126FFF2, ACTIVE 4350 sec
72 lock struct(s), heap size 14776, 688 row lock(s), undo log entries 20
MySQL thread id 1664538, OS thread handle 0x7f291fbb9700, query id 1375124128 10.100.4.23 xms_user
Trx read view will not see trx with id >= 4126FFF3, sees < 41263E6A
TABLE LOCK table `xmsbe`.`t_inter_ccrecall` trx id 4126FFF2 lock mode IX
RECORD LOCKS space id 880 page no 182 n bits 208 index `PRIMARY` of table `xmsbe`.`t_inter_ccrecall` trx id 4126FFF2 lock_mode X locks rec but not gap
RECORD LOCKS space id 880 page no 181 n bits 144 index `PRIMARY` of table `xmsbe`.`t_inter_ccrecall` trx id 4126FFF2 lock_mode X locks rec but not gap
RECORD LOCKS space id 880 page no 180 n bits 208 index `PRIMARY` of table `xmsbe`.`t_inter_ccrecall` trx id 4126FFF2 lock_mode X locks rec but not gap
RECORD LOCKS space id 880 page no 197 n bits 136 index `PRIMARY` of table `xmsbe`.`t_inter_ccrecall` trx id 4126FFF2 lock_mode X locks rec but not gap
RECORD LOCKS space id 880 page no 186 n bits 136 index `PRIMARY` of table `xmsbe`.`t_inter_ccrecall` trx id 4126FFF2 lock_mode X locks rec but not gap
RECORD LOCKS space id 880 page no 187 n bits 136 index `PRIMARY` of table `xmsbe`.`t_inter_ccrecall` trx id 4126FFF2 lock_mode X locks rec but not gap
RECORD LOCKS space id 880 page no 191 n bits 160 index `PRIMARY` of table `xmsbe`.`t_inter_ccrecall` trx id 4126FFF2 lock_mode X locks rec but not gap
RECORD LOCKS space id 880 page no 175 n bits 200 index `PRIMARY` of table `xmsbe`.`t_inter_ccrecall` trx id 4126FFF2 lock_mode X locks rec but not gap
RECORD LOCKS space id 880 page no 196 n bits 144 index `PRIMARY` of table `xmsbe`.`t_inter_ccrecall` trx id 4126FFF2 lock_mode X locks rec but not gap
TOO MANY LOCKS PRINTED FOR THIS TRX: SUPPRESSING FURTHER PRINTS
看了下R&D同学的sql,发现是insert 的时候insert 的时候 IGNORE,而不是select join is null。
修改sql就木有问题了,哇卡卡
INSERT IGNORE t_inter_ccrecall (serviceno,orgId,imei,businessType,serviceType,acceptTime,backTime,provinceId,cityId,customerName,tel,miliao,brandId, modelId)
SELECT A.id serviceno, A.org_id orgId, A.imei,'WX' businessType,A.service_type, A.sl_time acceptTime, A.fh_time backTime, A.province provinceId,
A.city cityId, A.custome_name customerName, A.mobile,A.miliao, A.brand_id, A.model_id
FROM t_srv_xmrepair A
JOIN t_base_org AS o ON A.org_id = o.id
WHERE A.wfactivityId = 'Returns_end'
AND A.repair_type='BN'
AND 30 >= TIMESTAMPDIFF(DAY,A.sl_time,A.fh_time)
AND (o.type in ('5') and A.org_id not in ('D10002','ETWZD','Eycgx','Eyctb','Eyctz'))
AND A.fh_time >='2013-11-12 16:00:01'
AND A.fh_time <= '2013-11-12 17:00:00'