问题描述如下:
2台web机器(java) ,一台数据库服务器(mysql),
现在2台机器同时往数据库服务器同1表插入或者修改数据, 导致死锁2台web机器,分别是web1 web2
web1是update a where a='N' and id in (1,2,3,4,54,45,4,5,45,4,5,4,5,4,5,4,5,.......)
web2是insert into 。。
是同一时刻,结果导致发生死锁。问该如何解决或者避免这个现象??
2台web机器(java) ,一台数据库服务器(mysql),
现在2台机器同时往数据库服务器同1表插入或者修改数据, 导致死锁2台web机器,分别是web1 web2
web1是update a where a='N' and id in (1,2,3,4,54,45,4,5,45,4,5,4,5,4,5,4,5,.......)
web2是insert into 。。
是同一时刻,结果导致发生死锁。问该如何解决或者避免这个现象??
2、请描叙得更加细致一些,你如何找出这两个SQL 之间出现互锁呢?
web1是update a where a='N' and id in (1,2,3,4,54,45,4,5,45,4,5,4,5,4,5,4,5,.......)过1秒进行下面
web2是insert into 。。
(前面的没有做完 , 这样造成行级锁)
理论上不会出现互锁问题。
现在估计是下面原因造成
server启动的时候“he unused history data will be delete. And at the same time, the updated data will insert into history table, so there will be conflict. ”
当针对这个表删除部分数据的时候, 同时被更新的数据再次插入数据库这个表??? (这个可能性大吗?)