insert into on duplicate key update导致的cap锁以及死锁
CREATE TABLE `tb2002` ( `id` int(11) NOT NULL AUTO_INCREMENT, `c1` varchar(20) DEFAULT NULL, `c2` varchar(20) DEFAULT NULL, `c3` int(11) DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `idx_c1` (`c1`,`c2`) ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; insert into tb2002(c1,c2) values('a','1'); insert into tb2002(c1,c2) values('f','1'); insert into tb2002(c1,c2) values('d','2') ON DUPLICATE KEY UPDATE c3=c3+1; insert into tb2002(c1,c2) values('c','1') ON DUPLICATE KEY UPDATE c3=c3+1; insert into tb2002(c1,c2) values('d','1') ON DUPLICATE KEY UPDATE c3=c3+1;