checklist优化

背景:

报错信息:

org.springframework.dao.CannotAcquireLockException: 
### Error updating database.  Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction
### The error may exist in com/datamesh/tissue/checklist/provider/mapper/CheckListPointDeviceTaskMapper.java (best guess)
### The error may involve com.datamesh.tissue.checklist.provider.mapper.CheckListPointDeviceTaskMapper.updateById-Inline
### The error occurred while setting parameters
### SQL: UPDATE cloud_checklist_point_device_task  SET tenant_id=?, point_device_id=?, task_plan_id=?, task_id=?, skip_scan=?, device_id=?,   create_time=?, update_time=?,  exception_skip=?, temp_dispatch=?, check_duplication=?, device_status=?  WHERE id=?  AND del_flag=0
### Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction
; Lock wait timeout exceeded; try restarting transaction; nested exception is com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction
	at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:267) ~[spring-jdbc-5.3.26.jar!/:5.3.26]
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70) ~[spring-jdbc-5.3.26.jar!/:5.3.26]

数据库死锁

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: dtcs_tenant_cn_206 - Connection is not available, request timed out after 10000ms.
### The error may exist in com/datamesh/tissue/tenant/provider/mapper/user/UserLogMapper.java (best guess)
### The error may involve com.datamesh.tissue.tenant.provider.mapper.user.UserLogMapper.insert
### The error occurred while executing an update
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: dtcs_tenant_cn_206 - Connection is not available, request timed out after 10000ms.

优化思路:

1、加索引

2、加缓存

3、多线程调用

批处理 rewriteBatchedStatements=true

数据库连接失败及数据库死锁优化解决

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值