seata 报错 LockConflictException: get global lock fail
springcloud+seata+mybatis+mysql,eureka+db模式,使用注释@GlobalTransactional+@transactional,在跨服务场景下一切正常,但是在单服务场景下的方法上加入两个事务注解运行出现异常(逻辑判断有可能调用其他服务也有可能不调用,问题出现在不调用其他服务的场景下)
org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is io.seata.rm.datasource.exec.LockConflictException: get global lock fail, xid:192.168.1.48:8091:4008686782, lockKeys:lesson_topic:1250817221014327297;cancel_lesson:1250817473905692673;lesson_topic:1250817473876332545;lesson_class:1250817221026910209;foreign_teacher_booked_record:1250817473972801537;lesson:1250817473859555329;lesson_class:1250817473888915457;lesson:1250817220997550081
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCommit(DataSourceTransactionManager.java:332)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:746)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:714)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:534)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:305)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at io.seata.spring.annotation.GlobalTransactionalInterceptor$1.execute(GlobalTransactionalInterceptor.java:109)
at io.seata.tm.api.TransactionalTemplate.execute(TransactionalTemplate.java:64)
at io.seata.spring.annotation.GlobalTransactionalInterceptor.handleGlobalTransaction(GlobalTransactionalInterceptor.java:106)
Caused by: io.seata.rm.datasource.exec.LockConflictException: get global lock fail, xid:192.168.1.48:8091:4008686782, lockKeys:lesson_topic:1250817221014327297;cancel_lesson:1250817473905692673;lesson_topic:1250817473876332545;lesson_class:1250817221026910209;foreign_teacher_booked_record:1250817473972801537;lesson:1250817473859555329;lesson_class:1250817473888915457;lesson:1250817220997550081
at io.seata.rm.datasource.ConnectionProxy.recognizeLockKeyConflictException(ConnectionProxy.java:149)
at io.seata.rm.datasource.ConnectionProxy.processGlobalTransactionCommit(ConnectionProxy.java:213)
at io.seata.rm.datasource.ConnectionProxy.doCommit(ConnectionProxy.java:190)
at io.seata.rm.datasource.ConnectionProxy.lambda$commit$0(ConnectionProxy.java:178)
at io.seata.rm.datasource.ConnectionProxy$LockRetryPolicy.execute(ConnectionProxy.java:283)
at io.seata.rm.datasource.ConnectionProxy.commit(ConnectionProxy.java:177)
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCommit(DataSourceTransactionManager.java:329)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:746)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:714)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:534)
java.sql.BatchUpdateException: Data truncation: Data too long for column 'row_key' at row 1 原因是db模式的key长度为128,key长度超过了128,扩展了字段长度就正常了
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。