lolashe opened a new issue #9180:
URL: https://github.com/apache/shardingsphere/issues/9180
## Bug Report
shardingsphere 4.1.0
seata 1.2.0
mysql table:
CREATE TABLE `cp_d_product` (
`id` bigint NOT NULL COMMENT '主键',
`mch_id` bigint NOT NULL COMMENT '商户id',
`product_no` bigint NOT NULL COMMENT '产品编号',
`product_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT
NULL DEFAULT '' COMMENT '产品名称',
`spu` int NOT NULL COMMENT '库存',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_product_no` (`product_no`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='产品表';
CREATE TABLE `cp_d_product_price` (
`id` bigint NOT NULL COMMENT '主键',
`mch_id` bigint DEFAULT NULL COMMENT '商户主键',
`product_no` bigint DEFAULT NULL COMMENT '产品编号',
`price` decimal(10,2) DEFAULT NULL COMMENT '产品单价',
`discount` float(5,2) DEFAULT NULL COMMENT '产品折扣',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品价格表';
java code:
@Override
@GlobalTransactional(timeoutMills = 120000,name = "my_addProductInfo")
@ShardingTransactionType(TransactionType.BASE)
public void addProductInfo() {
Product product = new Product();
product.setMchId(7L);
product.setProductNo(3L);
product.setProductName("苹果");
product.setSpu(100);
product.setCreateTime(new Date());
iProductService.insertSelective(product);
ProductPrice productPrice = new ProductPrice();
productPrice.setMchId(7L);
productPrice.setProductNo(3L);
productPrice.setPrice(new BigDecimal(1));
productPrice.setDiscount(0.8f);
productPrice.setCreateTime(new Date());
iProductPriceService.insertSelective(productPrice);
// throw exception
Integer.parseInt("sdfs");
}
### Which version of ShardingSphere did you use?
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
### Expected behavior
i expected code execute success and data can rollback
### Actual behavior
2021-01-27 10:30:46.908 INFO 14624 --- [ main]
io.seata.tm.TransactionManagerHolder : TransactionManager Singleton
io.seata.tm.DefaultTransactionManager@1c97c3bb
2021-01-27 10:30:46.914 INFO 14624 --- [ main]
i.s.c.r.netty.NettyClientChannelManager : will connect to 10.10.1.129:8091
2021-01-27 10:30:46.914 INFO 14624 --- [ main]
i.s.core.rpc.netty.NettyPoolableFactory : NettyPool create channel to
transactionRole:TMROLE,address:10.10.1.129:8091,msg:<
RegisterTMRequest{applicationId='charge-product',
transactionServiceGroup='my_product_tx_group'} >
2021-01-27 10:30:46.919 INFO 14624 --- [ main]
io.seata.core.rpc.netty.TmRpcClient : register TM success. server
version:1.2.0,channel:[id: 0x294d7fb4, L:/10.10.1.129:55762 -
R:/10.10.1.129:8091]
2021-01-27 10:30:46.920 INFO 14624 --- [ main]
i.s.core.rpc.netty.NettyPoolableFactory : register success, cost 3 ms,
version:1.2.0,role:TMROLE,channel:[id: 0x294d7fb4, L:/10.10.1.129:55762 -
R:/10.10.1.129:8091]
2021-01-27 10:30:46.936 INFO 14624 --- [ main]
i.seata.tm.api.DefaultGlobalTransaction : Begin new global transaction
[10.10.1.129:8091:2002223213]
2021-01-27 10:30:47.027 INFO 14624 --- [ main]
io.seata.core.rpc.netty.RmRpcClient : will register
resourceId:jdbc:mysql://127.0.0.1:3306/product0
2021-01-27 10:30:47.540 WARN 14624 --- [ main]
ServiceLoader$InnerEnhancedServiceLoader : The same extension
io.seata.sqlparser.druid.mysql.MySQLOperateRecognizerHolder has already been
loaded, skipped
2021-01-27 10:30:47.541 WARN 14624 --- [ main]
ServiceLoader$InnerEnhancedServiceLoader : The same extension
io.seata.sqlparser.druid.oracle.OracleOperateRecognizerHolder has already been
loaded, skipped
2021-01-27 10:30:47.541 WARN 14624 --- [ main]
ServiceLoader$InnerEnhancedServiceLoader : The same extension
io.seata.sqlparser.druid.postgresql.PostgresqlOperateRecognizerHolder has
already been loaded, skipped
2021-01-27 10:30:47.691 INFO 14624 --- [ main] ShardingSphere-SQL
: Logic SQL: SELECT * FROM `cp_d_product` LIMIT 1
2021-01-27 10:30:47.692 INFO 14624 --- [ main] ShardingSphere-SQL
: SQLStatement:
SelectStatementContext(super=CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.sql.parser.sql.statement.dml.SelectStatement@515555b,
tablesContext=org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContext@58e2af93),
tablesContext=org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContext@58e2af93,
projectionsContext=ProjectionsContext(startIndex=7, stopIndex=7,
distinctRow=false, projections=[ShorthandProjection(owner=Optional.empty,
actualColumns=[ColumnProjection(owner=null, name=id, alias=Optional.empty),
ColumnProjection(owner=null, name=mch_id, alias=Optional.empty),
ColumnProjection(owner=null, name=product_no, alias=Optional.empty),
ColumnProjection(owner=null, name=product_name, alias=Optional.empty),
ColumnProjection(owner=null, name=spu, alias=Optional.empty),
ColumnProjection(owner=null, name=create_time, alias=Opti
onal.empty), ColumnProjection(owner=null, name=update_time,
alias=Optional.empty)])]),
groupByContext=org.apache.shardingsphere.sql.parser.binder.segment.select.groupby.GroupByContext@204beb58,
orderByContext=org.apache.shardingsphere.sql.parser.binder.segment.select.orderby.OrderByContext@2e10f765,
paginationContext=org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext@100d071,
containsSubquery=false)
2021-01-27 10:30:47.692 INFO 14624 --- [ main] ShardingSphere-SQL
: Actual SQL: ds0 ::: SELECT * FROM `cp_d_product_0`
LIMIT 1
2021-01-27 10:30:47.692 INFO 14624 --- [ main] ShardingSphere-SQL
: Actual SQL: ds0 ::: SELECT * FROM `cp_d_product_1`
LIMIT 1
2021-01-27 10:30:47.692 INFO 14624 --- [ main] ShardingSphere-SQL
: Actual SQL: ds0 ::: SELECT * FROM `cp_d_product_2`
LIMIT 1
2021-01-27 10:30:47.692 INFO 14624 --- [ main] ShardingSphere-SQL
: Actual SQL: ds1 ::: SELECT * FROM `cp_d_product_0`
LIMIT 1
2021-01-27 10:30:47.692 INFO 14624 --- [ main] ShardingSphere-SQL
: Actual SQL: ds1 ::: SELECT * FROM `cp_d_product_1`
LIMIT 1
2021-01-27 10:30:47.692 INFO 14624 --- [ main] ShardingSphere-SQL
: Actual SQL: ds1 ::: SELECT * FROM `cp_d_product_2`
LIMIT 1
2021-01-27 10:30:47.692 INFO 14624 --- [ main] ShardingSphere-SQL
: Actual SQL: ds2 ::: SELECT * FROM `cp_d_product_0`
LIMIT 1
2021-01-27 10:30:47.692 INFO 14624 --- [ main] ShardingSphere-SQL
: Actual SQL: ds2 ::: SELECT * FROM `cp_d_product_1`
LIMIT 1
2021-01-27 10:30:47.692 INFO 14624 --- [ main] ShardingSphere-SQL
: Actual SQL: ds2 ::: SELECT * FROM `cp_d_product_2`
LIMIT 1
2021-01-27 10:30:47.815 INFO 14624 --- [ main] ShardingSphere-SQL
: Logic SQL: INSERT INTO `cp_d_product` (
`mch_id`,`product_no`,`product_name`,`spu`,`create_time` ) VALUES( ?,?,?,?,? )
2021-01-27 10:30:47.815 INFO 14624 --- [ main] ShardingSphere-SQL
: SQLStatement:
InsertStatementContext(super=CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.sql.parser.sql.statement.dml.InsertStatement@ea3491d,
tablesContext=org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContext@6012bee8),
tablesContext=org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContext@6012bee8,
columnNames=[mch_id, product_no, product_name, spu, create_time],
insertValueContexts=[InsertValueContext(parametersCount=5,
valueExpressions=[ParameterMarkerExpressionSegment(startIndex=97, stopIndex=97,
parameterMarkerIndex=0), ParameterMarkerExpressionSegment(startIndex=99,
stopIndex=99, parameterMarkerIndex=1),
ParameterMarkerExpressionSegment(startIndex=101, stopIndex=101,
parameterMarkerIndex=2), ParameterMarkerExpressionSegment(startIndex=103,
stopIndex=103, parameterMarkerIndex=3),
ParameterMarkerExpressionSegment(startIndex=
105, stopIndex=105, parameterMarkerIndex=4),
DerivedParameterMarkerExpressionSegment(super=ParameterMarkerExpressionSegment(startIndex=0,
stopIndex=0, parameterMarkerIndex=5))], parameters=[7, 3, 苹果, 100, 2021-01-27
10:30:46.941])],
generatedKeyContext=Optional[GeneratedKeyContext(columnName=id, generated=true,
generatedValues=[561135160985124864])])
2021-01-27 10:30:47.815 INFO 14624 --- [ main] ShardingSphere-SQL
: Actual SQL: ds1 ::: INSERT INTO `cp_d_product_0` (
`mch_id`,`product_no`,`product_name`,`spu`,`create_time` , id) VALUES(?, ?, ?,
?, ?, ?) ::: [7, 3, 苹果, 100, 2021-01-27 10:30:46.941, 561135160985124864]
2021-01-27 10:30:47.856 ERROR 14624 --- [ main]
i.s.r.d.exec.AbstractDMLBaseExecutor : execute executeAutoCommitTrue
error:null
io.seata.common.exception.ShouldNeverHappenException: null
at
io.seata.rm.datasource.exec.InsertExecutor.mysqlGeneratedKeys(InsertExecutor.java:344)
at
io.seata.rm.datasource.exec.InsertExecutor.getPkValuesByAuto(InsertExecutor.java:247)
at
io.seata.rm.datasource.exec.InsertExecutor.afterImage(InsertExecutor.java:79)
at
io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitFalse(AbstractDMLBaseExecutor.java:88)
at
io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.lambda$executeAutoCommitTrue$0(AbstractDMLBaseExecutor.java:105)
at
io.seata.rm.datasource.ConnectionProxy$LockRetryPolicy.doRetryOnLockConflict(ConnectionProxy.java:299)
at
io.seata.rm.datasource.exec.AbstractDMLBaseExecutor$LockRetryPolicy.execute(AbstractDMLBaseExecutor.java:149)
at
io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitTrue(AbstractDMLBaseExecutor.java:104)
at
io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.doExecute(AbstractDMLBaseExecutor.java:72)
at
io.seata.rm.datasource.exec.BaseTransactionalExecutor.execute(BaseTransactionalExecutor.java:110)
at
io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:108)
at
io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:49)
at
io.seata.rm.datasource.PreparedStatementProxy.execute(PreparedStatementProxy.java:54)
at
org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46)
at
org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at
org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at
org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
at com.sun.proxy.$Proxy120.update(Unknown Source)
at
org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
at
org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
at com.sun.proxy.$Proxy81.insert(Unknown Source)
at
org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:58)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy91.insertSelective(Unknown Source)
at
cn.com.lolashe.product.common.BaseServiceImpl.insertSelective(BaseServiceImpl.java:27)
at
cn.com.lolashe.product.dubbo.impl.ProductServiceImpl.addProductInfo(ProductServiceImpl.java:53)
at
cn.com.lolashe.product.dubbo.impl.ProductServiceImpl$$FastClassBySpringCGLIB$$1f64399f.invoke(<generated>)
at
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at
io.seata.spring.annotation.GlobalTransactionalInterceptor$1.execute(GlobalTransactionalInterceptor.java:109)
at
io.seata.tm.api.TransactionalTemplate.execute(TransactionalTemplate.java:104)
at
io.seata.spring.annotation.GlobalTransactionalInterceptor.handleGlobalTransaction(GlobalTransactionalInterceptor.java:106)
at
io.seata.spring.annotation.GlobalTransactionalInterceptor.invoke(GlobalTransactionalInterceptor.java:83)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at
org.apache.shardingsphere.transaction.spring.ShardingTransactionTypeInterceptor.invoke(ShardingTransactionTypeInterceptor.java:41)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
at
cn.com.lolashe.product.dubbo.impl.ProductServiceImpl$$EnhancerBySpringCGLIB$$9a719241.addProductInfo(<generated>)
at cn.com.lolashe.product.SeataTest.testSeata(SeataTest.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at
org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at
org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at
org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at
org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at
org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at
org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
2021-01-27 10:30:47.924 INFO 14624 --- [ main]
i.seata.tm.api.DefaultGlobalTransaction : [10.10.1.129:8091:2002223213]
rollback status: Rollbacked
org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: java.sql.SQLException:
io.seata.common.exception.ShouldNeverHappenException
### The error may involve
cn.com.lolashe.product.dao.auto.ProductMapper.insertSelective-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO `cp_d_product` (
`mch_id`,`product_no`,`product_name`,`spu`,`create_time` ) VALUES( ?,?,?,?,? )
### Cause: java.sql.SQLException:
io.seata.common.exception.ShouldNeverHappenException
; uncategorized SQLException; SQL state [null]; error code [0];
io.seata.common.exception.ShouldNeverHappenException; nested exception is
java.sql.SQLException: io.seata.common.exception.ShouldNeverHappenException
at
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89)
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:446)
at com.sun.proxy.$Proxy81.insert(Unknown Source)
at
org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:58)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy91.insertSelective(Unknown Source)
at
cn.com.lolashe.product.common.BaseServiceImpl.insertSelective(BaseServiceImpl.java:27)
at
cn.com.lolashe.product.dubbo.impl.ProductServiceImpl.addProductInfo(ProductServiceImpl.java:53)
at
cn.com.lolashe.product.dubbo.impl.ProductServiceImpl$$FastClassBySpringCGLIB$$1f64399f.invoke(<generated>)
at
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at
io.seata.spring.annotation.GlobalTransactionalInterceptor$1.execute(GlobalTransactionalInterceptor.java:109)
at
io.seata.tm.api.TransactionalTemplate.execute(TransactionalTemplate.java:104)
at
io.seata.spring.annotation.GlobalTransactionalInterceptor.handleGlobalTransaction(GlobalTransactionalInterceptor.java:106)
at
io.seata.spring.annotation.GlobalTransactionalInterceptor.invoke(GlobalTransactionalInterceptor.java:83)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at
org.apache.shardingsphere.transaction.spring.ShardingTransactionTypeInterceptor.invoke(ShardingTransactionTypeInterceptor.java:41)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
at
cn.com.lolashe.product.dubbo.impl.ProductServiceImpl$$EnhancerBySpringCGLIB$$9a719241.addProductInfo(<generated>)
at cn.com.lolashe.product.SeataTest.testSeata(SeataTest.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at
org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at
org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at
org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at
org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at
org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at
org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: java.sql.SQLException:
io.seata.common.exception.ShouldNeverHappenException
at
io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:112)
at
io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:49)
at
io.seata.rm.datasource.PreparedStatementProxy.execute(PreparedStatementProxy.java:54)
at
org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46)
at
org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at
org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at
org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
at com.sun.proxy.$Proxy120.update(Unknown Source)
at
org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
at
org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
... 51 more
Caused by: io.seata.common.exception.ShouldNeverHappenException
at
io.seata.rm.datasource.exec.InsertExecutor.mysqlGeneratedKeys(InsertExecutor.java:344)
at
io.seata.rm.datasource.exec.InsertExecutor.getPkValuesByAuto(InsertExecutor.java:247)
at
io.seata.rm.datasource.exec.InsertExecutor.afterImage(InsertExecutor.java:79)
at
io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitFalse(AbstractDMLBaseExecutor.java:88)
at
io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.lambda$executeAutoCommitTrue$0(AbstractDMLBaseExecutor.java:105)
at
io.seata.rm.datasource.ConnectionProxy$LockRetryPolicy.doRetryOnLockConflict(ConnectionProxy.java:299)
at
io.seata.rm.datasource.exec.AbstractDMLBaseExecutor$LockRetryPolicy.execute(AbstractDMLBaseExecutor.java:149)
at
io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitTrue(AbstractDMLBaseExecutor.java:104)
at
io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.doExecute(AbstractDMLBaseExecutor.java:72)
at
io.seata.rm.datasource.exec.BaseTransactionalExecutor.execute(BaseTransactionalExecutor.java:110)
at
io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:108)
... 71 more
### Reason analyze (If you can)
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
spring:
shardingsphere:
sharding:
default-key-generator:
column: id
type: SNOWFLAKE
tables:
cp_d_product:
actualDataNodes: ds$->{0..2}.cp_d_product_$->{0..2}
databaseStrategy:
inline:
shardingColumn: mch_id
algorithmExpression: ds$->{mch_id % 3}
tableStrategy:
inline:
shardingColumn: product_no
algorithmExpression: cp_d_product_$->{product_no % 3}
keyGenerator:
column: id
type: SNOWFLAKE
props:
worker.id: 123
cp_d_product_price:
actualDataNodes: ds$->{0..2}.cp_d_product_price_$->{0..2}
databaseStrategy:
inline:
shardingColumn: mch_id
algorithmExpression: ds$->{mch_id % 3}
tableStrategy:
inline:
shardingColumn: product_no
algorithmExpression: cp_d_product_price_$->{product_no % 3}
keyGenerator:
column: id
type: SNOWFLAKE
props:
worker.id: 123
binding-tables:
- cp_d_product,cp_d_product_price
props:
sql:
show: true
### Example codes for reproduce this issue (such as a github link).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]