mysql解决错误The total number of locks exceeds the lock table size

mysql | 2019-09-13 10:02:39

mysql错误The total number of locks exceeds the lock table size:

具体如下:

### Error updating database.  Cause: java.sql.SQLException: The total number of locks exceeds the lock table size
### The error may involve com.ajia.data.synchronize.dao.QuestPointScoreMapper.deleteByProjectId-Inline
### The error occurred while setting parameters
### SQL: delete from quest_point_score    WHERE PROJECT_ID=?
### Cause: java.sql.SQLException: The total number of locks exceeds the lock table size
; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1206]; The total number of locks exceeds the lock table size; nested exception is java.sql.SQLException: The total number of locks exceeds the lock table size
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
at com.sun.proxy.$Proxy15.delete(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.delete(SqlSessionTemplate.java:268)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:57)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy35.deleteByProjectId(Unknown Source)
at com.ajia.data.synchronize.service.score.impl.QuestPointScoreServiceImpl.deleteByProjectId(QuestPointScoreServiceImpl.java:104)
at com.ajia.data.synchronize.service.score.impl.QuestPointScoreServiceImpl$$FastClassBySpringCGLIB$$5b6b3488.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
at com.ajia.data.synchronize.service.score.impl.QuestPointScoreServiceImpl$$EnhancerBySpringCGLIB$$c5ab72ee.deleteByProjectId(<generated>)
at com.ajia.data.synchronize.chain.impl.SynchronizePointScoreHandler.deleteByProjectId(SynchronizePointScoreHandler.java:402)
... 27 more


解决方法:

1.设置innodb_buffer_pool_size大一点

查看innodb_buffer_pool_size

mysql> SELECT @@innodb_buffer_pool_size;

修改innodb_buffer_pool_size

mysql> SET GLOBAL innodb_buffer_pool_size=2147483648;

改为2g.

注意mysql5.7版本之后的修改即生效,以前版本的得修改my.cnf再重启。



2.修改配置文件的调整方法,修改my.cnf配置:

innodb_buffer_pool_size = 2147483648  #设置2G

innodb_buffer_pool_size = 2G  #设置2G

innodb_buffer_pool_size = 500M  #设置500M


登录后即可回复 登录 | 注册
    
关注编程学问公众号