apache / incubator-seata

:fire: Seata is an easy-to-use, high-performance, open source distributed transaction solution.
https://seata.apache.org/
Apache License 2.0
25.39k stars 8.79k forks source link

Oracle 批量入库Sql未结束 #3078

Open GithubRyze opened 4 years ago

GithubRyze commented 4 years ago

Ⅰ. Issue Description

Java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

Ⅱ. Describe what happened

在Docker+Openshift环境中,我们使用的是dubbo 的微服务架构,上个礼拜发现mybatis 批量入库oracle 出现异常,异常信息Java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended。 经过我们单测和swagger 模拟接口数据调用发现都无法重现此问题。 后面经过进一步和其他团队沟通,发现他们在调用我们接口的时候的函数上加了分布式事务。今天我们让对方注释掉分布式事务注解后,发现此问题居然没有出现了,因此怀疑是否是Seata中的分布式事务导致,特来此询问。

Mybatis sql如下:
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
    INSERT into patient_bill_detail
    (ID, EMR_DETAIL_NO, VISIT_NO, VISIT_TYPE, FFS_FLAG, BILLING_ITEM_ID, BILLING_ITEM_NAME, BILLING_ITEM_CATEGORY_ID, BILLING_ITEM_CATEGORY_DESC,
    OPEN_DEPT,DOCTOR,AMOUNT,PRICE,COST,OBJECTION_FLAG,AMEND_DESC,PRODUCE_TIME,CREATED_AT,UPDATED_BY,UPDATED_AT,VERSION,OPEN_DEPT_DESC,
    FREE_FLAG,DISCOUNT,DOCTOR_ID,DOCTOR_ACCOUNT_CODE,BILLING_ITEM_GROUP_ID,GLOBAL_DISCOUNT_FLAG)
    <foreach collection="patientBillDetails" item="patientBillDetail" separator="union all">
      select
      #{patientBillDetail.id},#{patientBillDetail.emrDetailNo},#{patientBillDetail.visitNo},#{patientBillDetail.visitType},
      #{patientBillDetail.ffsFlag},#{patientBillDetail.billingItemId},#{patientBillDetail.billingItemName},
      #{patientBillDetail.billingItemCategoryId},#{patientBillDetail.billingItemCategoryDesc},#{patientBillDetail.openDept},
      #{patientBillDetail.doctor},#{patientBillDetail.amount},#{patientBillDetail.price},#{patientBillDetail.cost},
      #{patientBillDetail.objectionFlag},#{patientBillDetail.amendDesc},#{patientBillDetail.produceTime},
      #{patientBillDetail.createdAt},#{patientBillDetail.updatedBy},sysdate,0,#{patientBillDetail.openDeptDesc},#{patientBillDetail.freeFlag},#{patientBillDetail.discount},
      #{patientBillDetail.doctorId},#{patientBillDetail.doctorAccountCode},#{patientBillDetail.billingItemGroupId},#{patientBillDetail.globalDiscountFlag}
      from dual
    </foreach>
  </insert>

Mapper 接口代码如下:
int insertBatch(@Param("patientBillDetails") List<PatientBillDetail> patientBillDetails);

单元测试代码如下:
@Test
  public void testInsertBatch() {
    List<PatientBillDetail> list = new ArrayList<>();
    Date date = new Date();
    for (int i = 0; i < 10; i++) {
      PatientBillDetail patientBillDetail = new PatientBillDetail();
      patientBillDetail.setAmount(new BigDecimal("1000"));
      patientBillDetail.setAmendDesc("test amend");
      patientBillDetail.setBillingItemCategoryDesc("test category");
      patientBillDetail.setBillingItemCategoryId(UUID.randomUUID().toString());
      patientBillDetail.setBillingItemGroupId(UUID.randomUUID().toString());
      patientBillDetail.setBillingItemId(UUID.randomUUID().toString());
      patientBillDetail.setBillingItemName("ORAL GLUCOSE TOLERANCE TEST (0,1,2 HR)");
      patientBillDetail.setCost(new BigDecimal("100"));
      patientBillDetail.setDiscount(new BigDecimal("100"));
      patientBillDetail.setDoctor("EMRO1 ;");
      patientBillDetail.setDoctorAccountCode(" ;TEST ");
      patientBillDetail.setDoctorId("EMR01");
      patientBillDetail.setEmrDetailNo(UUID.randomUUID().toString());
      patientBillDetail.setFfsFlag("1");
      patientBillDetail.setFreeFlag(true);
      patientBillDetail.setGlobalDiscountFlag("1");
      patientBillDetail.setId(UUID.randomUUID().toString());
      patientBillDetail.setObjectionFlag(true);
      patientBillDetail.setOpenDept("test ;");
      patientBillDetail.setOpenDeptDesc("test ;");
      patientBillDetail.setPrice(new BigDecimal(i));
      patientBillDetail.setProduceTime(date);
      patientBillDetail.setVisitNo("1");
      patientBillDetail.setVisitType("1");
      list.add(patientBillDetail);
    }
    patientBillDetailMapper.insertBatch(list);
  }

环境上异常日志如下:
org.springframework.jdbc.BadSqlGrammarException: 
### Error updating database.  Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

### The error may involve com.ewell.bill.mapper.PatientBillDetailMapper.insertBatch-Inline
### The error occurred while setting parameters
### SQL: INSERT into patient_bill_detail     (ID, EMR_DETAIL_NO, VISIT_NO, VISIT_TYPE, FFS_FLAG, BILLING_ITEM_ID, BILLING_ITEM_NAME, BILLING_ITEM_CATEGORY_ID, BILLING_ITEM_CATEGORY_DESC,     OPEN_DEPT,DOCTOR,AMOUNT,PRICE,COST,OBJECTION_FLAG,AMEND_DESC,PRODUCE_TIME,CREATED_AT,UPDATED_BY,UPDATED_AT,VERSION,OPEN_DEPT_DESC,     FREE_FLAG,DISCOUNT,DOCTOR_ID,DOCTOR_ACCOUNT_CODE,BILLING_ITEM_GROUP_ID,GLOBAL_DISCOUNT_FLAG)              select       ?,?,?,?,       ?,?,?,       ?,?,?,       ?,?,?,?,       ?,?,?,       ?,?,sysdate,0,?,?,?,       ?,?,?,?       from dual
### Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

    at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:93)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
    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.$Proxy137.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.$Proxy182.insertBatch(Unknown Source)
    at com.ewell.bill.component.BillPublicComponent.saveNewestBillDetail(BillPublicComponent.java:722)
    at com.ewell.bill.service.impl.dubbo.BillInfoServiceImpl.emrSubmitToBill(BillInfoServiceImpl.java:432)
    at com.ewell.bill.service.impl.dubbo.BillInfoServiceImpl.billResultCallback(BillInfoServiceImpl.java:342)
    at com.ewell.bill.service.impl.dubbo.BillInfoServiceImpl$$FastClassBySpringCGLIB$$6c989bba.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
    at com.ewell.bill.service.impl.dubbo.BillInfoServiceImpl$$EnhancerBySpringCGLIB$$608891b7.billResultCallback(<generated>)
    at com.alibaba.dubbo.common.bytecode.Wrapper20.invokeMethod(Wrapper20.java)
    at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47)
    at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:76)
    at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:52)
    at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56)
    at com.ewell.bill.config.BillingLogFilter.invoke(BillingLogFilter.java:48)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at io.seata.integration.dubbo.alibaba.AlibabaDubboTransactionPropagationFilter.invoke(AlibabaDubboTransactionPropagationFilter.java:68)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at co.faao.plugin.filter.ProviderExceptionFilter.invoke(ProviderExceptionFilter.java:30)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:62)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at co.faao.plugin.starter.jaeger.opentracing.filter.OpenTracingFilter.processProviderTrace(OpenTracingFilter.java:99)
    at co.faao.plugin.starter.jaeger.opentracing.filter.OpenTracingFilter.invoke(OpenTracingFilter.java:64)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at co.faao.plugin.starter.dubbo.filter.UserFilter.invoke(UserFilter.java:39)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:73)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:138)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:104)
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96)
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:172)
    at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
    at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1044)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3685)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1376)
    at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3461)
    at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
    at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3459)
    at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:167)
    at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:497)
    at io.seata.rm.datasource.PreparedStatementProxy.lambda$execute$0(PreparedStatementProxy.java:54)
    at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:119)
    at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:61)
    at io.seata.rm.datasource.PreparedStatementProxy.execute(PreparedStatementProxy.java:54)
    at sun.reflect.GeneratedMethodAccessor450.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
    at com.sun.proxy.$Proxy236.execute(Unknown Source)
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46)
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
    at sun.reflect.GeneratedMethodAccessor750.invoke(Unknown Source)
    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.$Proxy234.update(Unknown Source)
    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.GeneratedMethodAccessor565.invoke(Unknown Source)
    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.$Proxy233.update(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor565.invoke(Unknown Source)
    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.$Proxy233.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.GeneratedMethodAccessor828.invoke(Unknown Source)
    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)
    ... 57 common frames omitted
2020-09-02 13:41:21,061 ERROR [billing-bill-ewell] [DubboServerHandler-10.131.5.202:20880-thread-200] [c.f.plugin.transmission.EmrCodeUtils:67] - trace[6c2e8fa1f2742e9a747ed07d7096b849:c696e83a7f7cc343:ea17657223a10c83:1] 服务异常:com.ewell.bill.dubbo.IBillInfoService:billResultCallback
java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1044)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3685)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1376)
    at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3461)
    at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
    at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3459)
    at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:167)
    at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:497)
    at io.seata.rm.datasource.PreparedStatementProxy.lambda$execute$0(PreparedStatementProxy.java:54)
    at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:119)
    at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:61)
    at io.seata.rm.datasource.PreparedStatementProxy.execute(PreparedStatementProxy.java:54)
    at sun.reflect.GeneratedMethodAccessor450.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
    at com.sun.proxy.$Proxy236.execute(Unknown Source)
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46)
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
    at sun.reflect.GeneratedMethodAccessor750.invoke(Unknown Source)
    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.$Proxy234.update(Unknown Source)
    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.GeneratedMethodAccessor565.invoke(Unknown Source)
    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.$Proxy233.update(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor565.invoke(Unknown Source)
    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.$Proxy233.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.GeneratedMethodAccessor828.invoke(Unknown Source)
    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.$Proxy137.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.$Proxy182.insertBatch(Unknown Source)
    at com.ewell.bill.component.BillPublicComponent.saveNewestBillDetail(BillPublicComponent.java:722)
    at com.ewell.bill.service.impl.dubbo.BillInfoServiceImpl.emrSubmitToBill(BillInfoServiceImpl.java:432)
    at com.ewell.bill.service.impl.dubbo.BillInfoServiceImpl.billResultCallback(BillInfoServiceImpl.java:342)
    at com.ewell.bill.service.impl.dubbo.BillInfoServiceImpl$$FastClassBySpringCGLIB$$6c989bba.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
    at com.ewell.bill.service.impl.dubbo.BillInfoServiceImpl$$EnhancerBySpringCGLIB$$608891b7.billResultCallback(<generated>)
    at com.alibaba.dubbo.common.bytecode.Wrapper20.invokeMethod(Wrapper20.java)
    at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47)
    at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:76)
    at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:52)
    at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56)
    at com.ewell.bill.config.BillingLogFilter.invoke(BillingLogFilter.java:48)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at io.seata.integration.dubbo.alibaba.AlibabaDubboTransactionPropagationFilter.invoke(AlibabaDubboTransactionPropagationFilter.java:68)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at co.faao.plugin.filter.ProviderExceptionFilter.invoke(ProviderExceptionFilter.java:30)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:62)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at co.faao.plugin.starter.jaeger.opentracing.filter.OpenTracingFilter.processProviderTrace(OpenTracingFilter.java:99)
    at co.faao.plugin.starter.jaeger.opentracing.filter.OpenTracingFilter.invoke(OpenTracingFilter.java:64)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at co.faao.plugin.starter.dubbo.filter.UserFilter.invoke(UserFilter.java:39)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:73)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:138)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:104)
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96)
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:172)
    at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
    at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Ⅲ. Describe what you expected to happen

Ⅴ. Anything else we need to know?

  1. 此接口会调用其他团队的接口聚合数据
  2. 存在本地数据库事务
  3. 批量入库
  4. 代码中同样存在其他的接口 采用相同的sql形式 进行批量入库操作,但是无分布式事务并且批量入库成功
  5. dubbo + zookeeper
  6. 使用SqlSession session = sqlSessionFactory.openSession(ExecutorType.BATCH) for循环入库是成功的

Ⅵ. Environment:

funky-eyes commented 4 years ago

你的服务有整合seata吗?如果没有,他们集成了seata对你没任何影响.如果集成了seata,如果tc不是同一个,你的本地事务都不会提交. 这个堆栈是调用方那边的还是你这个服务提供方的堆栈? 需要补充seata版本,Oracle驱动版本跟oracle版本

GithubRyze commented 4 years ago

@a364176773

  1. 双方都集成了Seata, 版本是seata-all1.1.0
  2. Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
  3. oracle 驱动 ojdbc6:11.2.0.3
  4. 堆栈信息是我们系统的
funky-eyes commented 4 years ago

@a364176773

  1. 双方都集成了Seata, 版本是seata-all1.1.0
  2. Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
  3. oracle 驱动 ojdbc6:11.2.0.3
  4. 堆栈信息是我们系统的

你们属于同一个tc?还是说他们为一个seata集群,你们为一个seata集群各自独立

funky-eyes commented 4 years ago

@a364176773

  1. 双方都集成了Seata, 版本是seata-all1.1.0
  2. Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
  3. oracle 驱动 ojdbc6:11.2.0.3
  4. 堆栈信息是我们系统的

建议先把驱动更换到最新的oracle驱动再做测试,有时候跟驱动有关系

GithubRyze commented 4 years ago

@a364176773

  1. 双方都集成了Seata, 版本是seata-all1.1.0
  2. Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
  3. oracle 驱动 ojdbc6:11.2.0.3
  4. 堆栈信息是我们系统的

建议先把驱动更换到最新的oracle驱动再做测试,有时候跟驱动有关系 我们是同属一个TC的。你的意思如果不是同个一个TC的话, 我们批量入库就不会commit, 不commit的话应该也不会出现上面的异常吧? 批量入库的sql我们有多个,其他都是正常的, 只有这个加有分布式事务的注解的接口 出现了此问题。 并且明显确认 去掉分布式注解是可以的。如果加油分布式事务注解的情况下 使用SqlSession session = sqlSessionFactory.openSession(ExecutorType.BATCH)
for循环入库 session.commit 是成功的。

funky-eyes commented 4 years ago

@a364176773

  1. 双方都集成了Seata, 版本是seata-all1.1.0
  2. Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
  3. oracle 驱动 ojdbc6:11.2.0.3
  4. 堆栈信息是我们系统的

建议先把驱动更换到最新的oracle驱动再做测试,有时候跟驱动有关系 我们是同属一个TC的。你的意思如果不是同个一个TC的话, 我们批量入库就不会commit, 不commit的话应该也不会出现上面的异常吧? 批量入库的sql我们有多个,其他都是正常的, 只有这个加有分布式事务的注解的接口 出现了此问题。 并且明显确认 去掉分布式注解是可以的。如果加油分布式事务注解的情况下 使用SqlSession session = sqlSessionFactory.openSession(ExecutorType.BATCH) for循环入库 session.commit 是成功的。

可以说可能有关,但是seata大部分跟oracle有关的问题跟驱动占很大原因,建议先换个最新的版本做测试

jsbxyyx commented 4 years ago

@GithubRyze not support insert xxx select xxx sql.