seata 报错 LockConflictException-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

seata 报错 LockConflictException

一人吃饱,全家不饿 2021-02-02 11:32:18 345

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)
分享到
取消 提交回答
全部回答(1)
  • 一人吃饱,全家不饿
    2021-02-02 11:51:26

    java.sql.BatchUpdateException: Data truncation: Data too long for column 'row_key' at row 1 原因是db模式的key长度为128,key长度超过了128,扩展了字段长度就正常了

    0 0
+ 订阅

我们开放源码,更相信社区的力量。

推荐文章
相似问题
链接