spring jpa更新不同事务中的一条记录。僵局

时间:2017-12-26 08:23:39

标签: java mysql jpa deadlock

mysql日志(显示引擎innodb状态)

if url.status_code in (200, 302, 301):

谁能解释日志?谢谢。!主要实体代码在

之下
(1) TRANSACTION:
TRANSACTION 255071, ACTIVE 0 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 5 lock struct(s), heap size 1184, 2 row lock(s), undo log entries 1
MySQL thread id 3625, OS thread handle 0x7f2eecd5eb00, query id 323014 localhost 127.0.0.1 root updating
update t_challenge_records set CREATED=1514179337707, STATUS='PROCESSING', UPDATED=1514275693337, CID=7, ENDDATE=20180101, ENDTIMED=180000, ENDTIMEU=0, ISSUE=null, LATESTDATE=20171226, LATESTTIME=160813, MONEY=5500, ORDERNO='201712222324423707842', PROFIT=0, REASON=null, ROOM='34', STARTDATE=20171226, STARTTIMED=70000, STARTTIMEU=0, SUBTYPE='D', TYPE='CUSTOM', USER='59f15fd966ec7707bc7a708e' where ID=33

 (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 264 page no 3 n bits 80 index `PRIMARY` of table `seblong`.`t_challenge_records` trx table locks 3 total table locks 4  trx id 255071 lock_mode X locks rec but not gap waiting lock hold time 0 wait time before grant 0 

 (2) TRANSACTION:
TRANSACTION 255072, ACTIVE 0 sec starting index read
mysql tables in use 1, locked 1
5 lock struct(s), heap size 1184, 2 row lock(s), undo log entries 1
MySQL thread id 3626, OS thread handle 0x7f2eef9b4b00, query id 323015 localhost 127.0.0.1 root updating
update t_challenge_records set CREATED=1514179337707, STATUS='PROCESSING', UPDATED=1514275693337, CID=7, ENDDATE=20180101, ENDTIMED=180000, ENDTIMEU=0, ISSUE=null, LATESTDATE=20171226, LATESTTIME=160813, MONEY=5500, ORDERNO='201712222324423707842', PROFIT=0, REASON=null, ROOM='34', STARTDATE=20171226, STARTTIMED=70000, STARTTIMEU=0, SUBTYPE='D', TYPE='CUSTOM', USER='59f15fd966ec7707bc7a708e' where ID=33

(2) HOLDS THE LOCK(S):
RECORD LOCKS space id 264 page no 3 n bits 80 index `PRIMARY` of table `seblong`.`t_challenge_records` trx table locks 3 total table locks 4  trx id 255072 lock mode S locks rec but not gap lock hold time 0 wait time before grant 0 

(2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 264 page no 3 n bits 80 index `PRIMARY` of table `seblong`.`t_challenge_records` trx table locks 3 total table locks 4  trx id 255072 lock_mode X locks rec but not gap waiting lock hold time 0 wait time before grant 0

 WE ROLL BACK TRANSACTION (2)

上面是jpa的实体,而更新方法只是找到记录,并改变日期和时间的参数。然后它会产生死锁。谁能帮助我?

0 个答案:

没有答案