赞
踩
jdbc批量更新时死锁.
java.sql.BatchUpdateException: Batch entry 910 UPDATESQL语句 was aborted:ERROR:deadlock detected
详细: Process 157988 waites for ShareLock on transaction 7944777; blocked by process 157400.
Process 157400 waites for ShareLock on transaction 7944775; blocked by process 157988.
建议:see server log for query details.
在位置:while updatingq tuple(1149,7)
in relation “table_name” Call getNextException to see other errors in batch.
java.sql.BatchUpdateException: Batch entry 910 UPDATESQL语句 was aborted:ERROR:deadlock detected
详细: Process 159216 waites for ShareLock on transaction 7944738; blocked by process 157989.
Process 157989 waites for ShareLock on transaction 7944739; blocked by process 159216.
…
在位置:while updating tuple(299,19) in relation “table_name” Call getNextException to see errors in the batch.
死锁了(deadlock detected)!
检查代码未见死锁代码,提示也指向数据库死锁.
推测是锁表导致的,单个updateById不会锁边,jdbc的批量更新.所以可能未执行索引.
加锁后,果然死锁消失.
记一次锁表导致的死锁异常.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。