redis+rabbitmq
之前遇到一个郁闷的问题,日志中时不时的会报出一个如下的错误。
org.apache.ibatis.exceptions.PersistenceException: ### Error updating DATABASE. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found WHEN trying TO GET LOCK; try restarting TRANSACTION ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: UPDATE tbl_marketing_coupon_scheme SET coupon_count = coupon_count+? WHERE id = ? ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found WHEN trying TO GET LOCK; try restarting TRANSACTION |
观察后发现应该是并发数太大,导致更新mysql数据库发生死锁。
coupon_count的实时性要求高,且追求准确度。
…