小言_互联网的博客

Seata 分布式事务功能测试(一)

319人阅读  评论(0)

基础代码参考:https://github.com/seata/seata/wiki/Quick-Start

本文的测试没有直接使用上面的项目,只是参考表和逻辑在我自己的框架中实现了一遍,实现过程中,还发现一些必要的信息。

0. 准备

0.1. 依赖

除了添加 seata-all 的依赖外,默认的 undo 序列化使用的 jackson,因此还需要相关的依赖才能启动成功。

0.2. 部分逻辑修改

主要是扣库存和扣款,where 条件增加了限制,如下:

0.3. 数据源

如果使用 druid,可以借助 druid-spring-boot-starterDruidDataSourceWrapper。由于这是一个包作用域的类,可以自己建个项目,将该类公布出来。

效果类似下面:

类:

实现很简单。

0.4. Seata 配置

关于配置文件可以看这里:https://blog.csdn.net/isea533/article/details/102390216

必要的配置是在 src/main/resources 下面都要有 file.confregistry.conf
其中 registry.conf 使用最简单的 file
file.conf 中我使用了 db,配置了数据源信息。

spring boot 中配置时,配置类有两种情况,在示例中的 business 中,不操作数据库,只调用其它服务,因此他的配置最简单:

@Configuration
public class SeataAutoConfig {

    /**
     * init global transaction scanner
     *
     * @Return: GlobalTransactionScanner
     */
    @Bean
    public GlobalTransactionScanner globalTransactionScanner() {
        return new GlobalTransactionScanner("business-gts-seata-example", "my_test_tx_group");
    }
}

在其他几个服务中,由于要连接数据库,因此需要使用 seata 提供的各种代理类:

@Configuration
public class SeataAutoConfig {

    @Bean(initMethod = "init")
    public DruidDataSource dataSource() {
        //这里使用了上面截图中的类
        return new PublicDruidDataSourceWrapper();
    }

    /**
     * init datasource proxy
     *
     * @Param: druidDataSource  datasource bean instance
     * @Return: DataSourceProxy  datasource proxy
     */
    @Bean
    public DataSourceProxy dataSourceProxy(DruidDataSource druidDataSource) {
        return new DataSourceProxy(druidDataSource);
    }

    @Bean
    public DataSourceTransactionManager transactionManager(DataSourceProxy dataSourceProxy) {
        return new DataSourceTransactionManager(dataSourceProxy);
    }

    /**
     * init mybatis sqlSessionFactory
     *
     * @Param: dataSourceProxy  datasource proxy
     * @Return: DataSourceProxy  datasource proxy
     */
    @Bean
    public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy) throws Exception {
        SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
        factoryBean.setDataSource(dataSourceProxy);
        factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
                .getResources("classpath*:/mappers/*/*.xml"));
        factoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
        return factoryBean.getObject();
    }

    /**
     * init global transaction scanner
     *
     * @Return: GlobalTransactionScanner
     */
    @Bean
    public GlobalTransactionScanner globalTransactionScanner() {
        return new GlobalTransactionScanner("storage-gts-seata-example", "my_test_tx_group");
    }
}

1. 初始值

属性
库存 1000
余额 4000
商品编号 C201901140001
用户 1

2. 业务流程

  1. 购买(business)
  2. 先扣库存(business->storage)
  3. 再减余额(business->order->account)
  4. 创建订单(business->order)

3. 测试用例

下面测试需要自己根据日志来理解,本文只提供了其中几个测试,后续还有补充。

3.1 测试用例 1

属性
库存 2000
余额 1000
商品编号 C201901140001
用户 1

结果:在库存环节出错,事务回滚。

3.1.1 business 日志:

2019-10-10 17:47:26,943 [DubboServerHandler-10.10.10.130:20883-thread-14] INFO  i.s.t.a.DefaultGlobalTransaction - Begin new global transaction [10.42.1.30:8091:2024332023]
开始全局事务,XID = 10.42.1.30:8091:2024332023
2019-10-10 17:47:26,961 [DubboServerHandler-10.10.10.130:20883-thread-14] INFO  i.s.t.a.DefaultGlobalTransaction - [10.42.1.30:8091:2024332023] rollback status:Rollbacked

3.1.2 storage 日志:

2019-10-10 17:47:26,947 [DubboServerHandler-10.10.10.130:20882-thread-4] DEBUG c.n.s.d.T.decreaseStorage - ==>  Preparing: update t_storage set count = count-2000 where commodity_code = ? and count >= ?
2019-10-10 17:47:26,947 [DubboServerHandler-10.10.10.130:20882-thread-4] DEBUG c.n.s.d.T.decreaseStorage - ==> Parameters: C201901140001(String), 2000(Integer)
2019-10-10 17:47:26,951 [DubboServerHandler-10.10.10.130:20882-thread-4] DEBUG c.n.s.d.T.decreaseStorage - <==    Updates: 0
2019-10-10 17:47:26,953 [DubboServerHandler-10.10.10.130:20882-thread-4] ERROR o.a.d.r.f.ExceptionFilter -  [DUBBO] Got unchecked and undeclared exception which called by 10.10.10.130. service: com.xx.storage.api.TStorageService, method: decreaseStorage, exception: java.lang.RuntimeException: 扣减库存失败, dubbo version: 2.7.1, current host: 10.10.10.130
java.lang.RuntimeException: 扣减库存失败
	at com.xx.storage.service.impl.TStorageServiceImpl.decreaseStorage(TStorageServiceImpl.java:24)

不会调用到 order 和 account。

3.2. 测试用例 2

属性
库存 1000
余额 5000
商品编号 C201901140001
用户 1

结果:在减余额环节出错,事务回滚。
库存应该不变!

3.2.1 business 日志:

2019-10-10 17:54:47,415 [DubboServerHandler-10.10.10.130:20883-thread-16] INFO  i.s.t.a.DefaultGlobalTransaction - Begin new global transaction [10.42.1.30:8091:2024332027]
开始全局事务,XID = 10.42.1.30:8091:2024332027
2019-10-10 17:54:48,998 [DubboServerHandler-10.10.10.130:20883-thread-16] INFO  i.s.t.a.DefaultGlobalTransaction - [10.42.1.30:8091:2024332027] rollback status:Rollbacked

3.2.2 storage 日志:

2019-10-10 17:54:47,429 [DubboServerHandler-10.10.10.130:20882-thread-2] INFO  i.s.c.l.EnhancedServiceLoader - load ContextCore[null] extension by class[io.seata.core.context.ThreadLocalContextCore]
2019-10-10 17:54:47,526 [DubboServerHandler-10.10.10.130:20882-thread-2] DEBUG c.n.s.d.T.decreaseStorage - ==>  Preparing: update t_storage set count = count-500 where commodity_code = ? and count >= ?
2019-10-10 17:54:47,543 [DubboServerHandler-10.10.10.130:20882-thread-2] DEBUG c.n.s.d.T.decreaseStorage - ==> Parameters: C201901140001(String), 500(Integer)
2019-10-10 17:54:47,807 [DubboServerHandler-10.10.10.130:20882-thread-2] DEBUG c.n.s.d.T.decreaseStorage - <==    Updates: 1
2019-10-10 17:54:47,813 [DubboServerHandler-10.10.10.130:20882-thread-2] INFO  i.s.c.l.EnhancedServiceLoader - load LoadBalance[null] extension by class[io.seata.discovery.loadbalance.RandomLoadBalance]
2019-10-10 17:54:48,022 [DubboServerHandler-10.10.10.130:20882-thread-2] INFO  i.s.c.l.EnhancedServiceLoader - load UndoLogParser[jackson] extension by class[io.seata.rm.datasource.undo.parser.JacksonUndoLogParser]
2019-10-10 17:54:48,791 [rpcDispatch_RMROLE_1_8] INFO  i.s.c.r.n.RmMessageListener - onMessage:xid=10.42.1.30:8091:2024332027,branchId=2024332030,branchType=AT,resourceId=jdbc:mysql://10.10.10.233:3306/seata_demo_storage,applicationData=null
2019-10-10 17:54:48,793 [rpcDispatch_RMROLE_1_8] INFO  i.s.r.AbstractRMHandler - Branch Rollbacking: 10.42.1.30:8091:2024332027 2024332030 jdbc:mysql://10.10.10.233:3306/seata_demo_storage
2019-10-10 17:54:48,923 [rpcDispatch_RMROLE_1_8] INFO  i.s.r.d.u.m.MySQLUndoLogManager - xid 10.42.1.30:8091:2024332027 branch 2024332030, undo_log deleted with GlobalFinished
2019-10-10 17:54:48,928 [rpcDispatch_RMROLE_1_8] INFO  i.s.r.AbstractRMHandler - Branch Rollbacked result: PhaseTwo_Rollbacked

3.2.3 account 日志:

2019-10-10 17:54:48,315 [DubboServerHandler-10.10.10.130:20880-thread-2] INFO  i.s.c.l.EnhancedServiceLoader - load ContextCore[null] extension by class[io.seata.core.context.ThreadLocalContextCore]
2019-10-10 17:54:48,374 [DubboServerHandler-10.10.10.130:20880-thread-2] DEBUG c.n.a.d.T.decreaseAccount - ==>  Preparing: update t_account set amount = amount-5000.0 where user_id = ? and amount >= ?
2019-10-10 17:54:48,392 [DubboServerHandler-10.10.10.130:20880-thread-2] DEBUG c.n.a.d.T.decreaseAccount - ==> Parameters: 1(String), 5000.0(Double)
2019-10-10 17:54:48,681 [DubboServerHandler-10.10.10.130:20880-thread-2] DEBUG c.n.a.d.T.decreaseAccount - <==    Updates: 0
2019-10-10 17:54:48,711 [DubboServerHandler-10.10.10.130:20880-thread-2] ERROR o.a.d.r.f.ExceptionFilter -  [DUBBO] Got unchecked and undeclared exception which called by 10.10.10.130. service: com.xx.account.api.TAccountService, method: decreaseAccount, exception: java.lang.RuntimeException: 扣款失败, dubbo version: 2.7.1, current host: 10.10.10.130
java.lang.RuntimeException: 扣款失败
	at com.xx.account.service.impl.TAccountServiceImpl.decreaseAccount(TAccountServiceImpl.java:26)

3.2.4 order 日志:

2019-10-10 17:54:48,726 [DubboServerHandler-10.10.10.130:20881-thread-3] ERROR o.a.d.r.f.ExceptionFilter -  [DUBBO] Got unchecked and undeclared exception which called by 10.10.10.130. service: com.xx.order.api.TOrderService, method: createOrder, exception: java.lang.RuntimeException: 扣款失败, dubbo version: 2.7.1, current host: 10.10.10.130
java.lang.RuntimeException: 扣款失败
	at com.xx.account.service.impl.TAccountServiceImpl.decreaseAccount(TAccountServiceImpl.java:26)

3.2.5 合并日志看整体执行顺序

服务 时间 日志
business 2019-10-10 17:54:47,415 [DubboServerHandler-10.10.10.130:20883-thread-16] INFO i.s.t.a.DefaultGlobalTransaction - Begin new global transaction [10.42.1.30:8091:2024332027]
business 2019-10-10 17:54:47,415 开始全局事务,XID = 10.42.1.30:8091:2024332027
storage 2019-10-10 17:54:47,429 [DubboServerHandler-10.10.10.130:20882-thread-2] INFO i.s.c.l.EnhancedServiceLoader - load ContextCore[null] extension by class[io.seata.core.context.ThreadLocalContextCore]
storage 2019-10-10 17:54:47,526 [DubboServerHandler-10.10.10.130:20882-thread-2] DEBUG c.n.s.d.T.decreaseStorage - ==> Preparing: update t_storage set count = count-500 where commodity_code = ? and count >= ?
storage 2019-10-10 17:54:47,543 [DubboServerHandler-10.10.10.130:20882-thread-2] DEBUG c.n.s.d.T.decreaseStorage - ==> Parameters: C201901140001(String), 500(Integer)
storage 2019-10-10 17:54:47,807 [DubboServerHandler-10.10.10.130:20882-thread-2] DEBUG c.n.s.d.T.decreaseStorage - <== Updates: 1
storage 2019-10-10 17:54:47,813 [DubboServerHandler-10.10.10.130:20882-thread-2] INFO i.s.c.l.EnhancedServiceLoader - load LoadBalance[null] extension by class[io.seata.discovery.loadbalance.RandomLoadBalance]
storage 2019-10-10 17:54:48,022 [DubboServerHandler-10.10.10.130:20882-thread-2] INFO i.s.c.l.EnhancedServiceLoader - load UndoLogParser[jackson] extension by class[io.seata.rm.datasource.undo.parser.JacksonUndoLogParser]
account 2019-10-10 17:54:48,315 [DubboServerHandler-10.10.10.130:20880-thread-2] INFO i.s.c.l.EnhancedServiceLoader - load ContextCore[null] extension by class[io.seata.core.context.ThreadLocalContextCore]
account 2019-10-10 17:54:48,374 [DubboServerHandler-10.10.10.130:20880-thread-2] DEBUG c.n.a.d.T.decreaseAccount - ==> Preparing: update t_account set amount = amount-5000.0 where user_id = ? and amount > ?
account 2019-10-10 17:54:48,392 [DubboServerHandler-10.10.10.130:20880-thread-2] DEBUG c.n.a.d.T.decreaseAccount - ==> Parameters: 1(String), 5000.0(Double)
account 2019-10-10 17:54:48,681 [DubboServerHandler-10.10.10.130:20880-thread-2] DEBUG c.n.a.d.T.decreaseAccount - <== Updates: 0
account 2019-10-10 17:54:48,711 [DubboServerHandler-10.10.10.130:20880-thread-2] ERROR o.a.d.r.f.ExceptionFilter - [DUBBO] Got unchecked and undeclared exception which called by 10.10.10.130. service: com.xx.account.api.TAccountService, method: decreaseAccount, exception: java.lang.RuntimeException: 扣款失败, dubbo version: 2.7.1, current host: 10.10.10.130
order 2019-10-10 17:54:48,726 [DubboServerHandler-10.10.10.130:20881-thread-3] ERROR o.a.d.r.f.ExceptionFilter - [DUBBO] Got unchecked and undeclared exception which called by 10.10.10.130. service: com.xx.order.api.TOrderService, method: createOrder, exception: java.lang.RuntimeException: 扣款失败, dubbo version: 2.7.1, current host: 10.10.10.130
storage 2019-10-10 17:54:48,791 [rpcDispatch_RMROLE_1_8] INFO i.s.c.r.n.RmMessageListener - onMessage:xid=10.42.1.30:8091:2024332027,branchId=2024332030,branchType=AT,resourceId=jdbc:mysql://10.10.10.233:3306/seata_demo_storage,applicationData=null
storage 2019-10-10 17:54:48,793 [rpcDispatch_RMROLE_1_8] INFO i.s.r.AbstractRMHandler - Branch Rollbacking: 10.42.1.30:8091:2024332027 2024332030 jdbc:mysql://10.10.10.233:3306/seata_demo_storage
storage 2019-10-10 17:54:48,923 [rpcDispatch_RMROLE_1_8] INFO i.s.r.d.u.m.MySQLUndoLogManager - xid 10.42.1.30:8091:2024332027 branch 2024332030, undo_log deleted with GlobalFinished
storage 2019-10-10 17:54:48,928 [rpcDispatch_RMROLE_1_8] INFO i.s.r.AbstractRMHandler - Branch Rollbacked result: PhaseTwo_Rollbacked
business 2019-10-10 17:54:48,998 [DubboServerHandler-10.10.10.130:20883-thread-16] INFO i.s.t.a.DefaultGlobalTransaction - [10.42.1.30:8091:2024332027] rollback status:Rollbacked

3.2.6 结论

从日志和我这里实现来看,只有开启分布式事务的调用方中抛出异常时才会触发回滚,因此如果所有业务方法中都抛出Runtime异常并且不吞掉时,异常能传递到最后的调用方,也会触发回滚。

3.3. 测试用例 3

属性
库存 500
余额 2000
商品编号 C201901140001
用户 1

结果:操作成功,库存变成500,余额变成2000,增加一个新订单

3.3.1 business 日志:

2019-10-10 17:57:43,871 [DubboServerHandler-10.10.10.130:20883-thread-17] INFO  i.s.t.a.DefaultGlobalTransaction - Begin new global transaction [10.42.1.30:8091:2024332035]
开始全局事务,XID = 10.42.1.30:8091:2024332035
2019-10-10 17:57:44,164 [DubboServerHandler-10.10.10.130:20883-thread-17] INFO  i.s.t.a.DefaultGlobalTransaction - [10.42.1.30:8091:2024332035] commit status:Committed

3.3.2 storage 日志:

2019-10-10 17:57:43,875 [DubboServerHandler-10.10.10.130:20882-thread-3] DEBUG c.n.s.d.T.decreaseStorage - ==>  Preparing: update t_storage set count = count-500 where commodity_code = ? and count >= ?
2019-10-10 17:57:43,875 [DubboServerHandler-10.10.10.130:20882-thread-3] DEBUG c.n.s.d.T.decreaseStorage - ==> Parameters: C201901140001(String), 500(Integer)
2019-10-10 17:57:43,880 [DubboServerHandler-10.10.10.130:20882-thread-3] DEBUG c.n.s.d.T.decreaseStorage - <==    Updates: 1
2019-10-10 17:57:44,657 [rpcDispatch_RMROLE_2_8] INFO  i.s.c.r.n.RmMessageListener - onMessage:xid=10.42.1.30:8091:2024332035,branchId=2024332037,branchType=AT,resourceId=jdbc:mysql://10.10.10.233:3306/seata_demo_storage,applicationData=null
2019-10-10 17:57:44,660 [rpcDispatch_RMROLE_2_8] INFO  i.s.r.AbstractRMHandler - Branch committing: 10.42.1.30:8091:2024332035 2024332037 jdbc:mysql://10.10.10.233:3306/seata_demo_storage null
2019-10-10 17:57:44,660 [rpcDispatch_RMROLE_2_8] INFO  i.s.r.AbstractRMHandler - Branch commit result: PhaseTwo_Committed

3.3.3 account 日志:

2019-10-10 17:57:43,908 [DubboServerHandler-10.10.10.130:20880-thread-3] DEBUG c.n.a.d.T.decreaseAccount - ==>  Preparing: update t_account set amount = amount-2000.0 where user_id = ? and amount >= ?
2019-10-10 17:57:43,909 [DubboServerHandler-10.10.10.130:20880-thread-3] DEBUG c.n.a.d.T.decreaseAccount - ==> Parameters: 1(String), 2000.0(Double)
2019-10-10 17:57:43,917 [DubboServerHandler-10.10.10.130:20880-thread-3] DEBUG c.n.a.d.T.decreaseAccount - <==    Updates: 1
2019-10-10 17:57:43,921 [DubboServerHandler-10.10.10.130:20880-thread-3] INFO  i.s.c.l.EnhancedServiceLoader - load LoadBalance[null] extension by class[io.seata.discovery.loadbalance.RandomLoadBalance]
2019-10-10 17:57:44,015 [DubboServerHandler-10.10.10.130:20880-thread-3] INFO  i.s.c.l.EnhancedServiceLoader - load UndoLogParser[jackson] extension by class[io.seata.rm.datasource.undo.parser.JacksonUndoLogParser]
2019-10-10 17:57:44,673 [rpcDispatch_RMROLE_1_8] INFO  i.s.c.r.n.RmMessageListener - onMessage:xid=10.42.1.30:8091:2024332035,branchId=2024332040,branchType=AT,resourceId=jdbc:mysql://10.10.10.233:3306/seata_demo_account,applicationData=null
2019-10-10 17:57:44,676 [rpcDispatch_RMROLE_1_8] INFO  i.s.r.AbstractRMHandler - Branch committing: 10.42.1.30:8091:2024332035 2024332040 jdbc:mysql://10.10.10.233:3306/seata_demo_account null
2019-10-10 17:57:44,676 [rpcDispatch_RMROLE_1_8] INFO  i.s.r.AbstractRMHandler - Branch commit result: PhaseTwo_Committed

3.3.4 order 日志:

2019-10-10 17:57:44,092 [DubboServerHandler-10.10.10.130:20881-thread-4] DEBUG c.n.o.d.T.insert - ==>  Preparing: INSERT INTO t_order ( id,order_no,user_id,commodity_code,count,amount ) VALUES( ?,?,?,?,?,? )
2019-10-10 17:57:44,092 [DubboServerHandler-10.10.10.130:20881-thread-4] DEBUG c.n.o.d.T.insert - ==> Parameters: 1314691584175899638(Long), bcc9e7739ab340fab5fbdbf58f667a02(String), 1(String), C201901140001(String), 500(Integer), 2000.0(Double)
2019-10-10 17:57:44,137 [DubboServerHandler-10.10.10.130:20881-thread-4] DEBUG c.n.o.d.T.insert - <==    Updates: 1
2019-10-10 17:57:44,682 [rpcDispatch_RMROLE_2_8] INFO  i.s.c.r.n.RmMessageListener - onMessage:xid=10.42.1.30:8091:2024332035,branchId=2024332043,branchType=AT,resourceId=jdbc:mysql://10.10.10.233:3306/seata_demo_order,applicationData=null
2019-10-10 17:57:44,683 [rpcDispatch_RMROLE_2_8] INFO  i.s.r.AbstractRMHandler - Branch committing: 10.42.1.30:8091:2024332035 2024332043 jdbc:mysql://10.10.10.233:3306/seata_demo_order null
2019-10-10 17:57:44,683 [rpcDispatch_RMROLE_2_8] INFO  i.s.r.AbstractRMHandler - Branch commit result: PhaseTwo_Committed

3.3.5 合并日志看整体执行顺序

服务 时间 日志
business 2019-10-10 17:57:43,871 [DubboServerHandler-10.10.10.130:20883-thread-17] INFO i.s.t.a.DefaultGlobalTransaction - Begin new global transaction [10.42.1.30:8091:2024332035]
business 2019-10-10 17:57:43,871 开始全局事务,XID = 10.42.1.30:8091:2024332035
storage 2019-10-10 17:57:43,875 [DubboServerHandler-10.10.10.130:20882-thread-3] DEBUG c.n.s.d.T.decreaseStorage - ==> Preparing: update t_storage set count = count-500 where commodity_code = ? and count >= ?
storage 2019-10-10 17:57:43,875 [DubboServerHandler-10.10.10.130:20882-thread-3] DEBUG c.n.s.d.T.decreaseStorage - ==> Parameters: C201901140001(String), 500(Integer)
storage 2019-10-10 17:57:43,880 [DubboServerHandler-10.10.10.130:20882-thread-3] DEBUG c.n.s.d.T.decreaseStorage - <== Updates: 1
account 2019-10-10 17:57:43,908 [DubboServerHandler-10.10.10.130:20880-thread-3] DEBUG c.n.a.d.T.decreaseAccount - ==> Preparing: update t_account set amount = amount-2000.0 where user_id = ? and amount > ?
account 2019-10-10 17:57:43,909 [DubboServerHandler-10.10.10.130:20880-thread-3] DEBUG c.n.a.d.T.decreaseAccount - ==> Parameters: 1(String), 2000.0(Double)
account 2019-10-10 17:57:43,917 [DubboServerHandler-10.10.10.130:20880-thread-3] DEBUG c.n.a.d.T.decreaseAccount - <== Updates: 1
account 2019-10-10 17:57:43,921 [DubboServerHandler-10.10.10.130:20880-thread-3] INFO i.s.c.l.EnhancedServiceLoader - load LoadBalance[null] extension by class[io.seata.discovery.loadbalance.RandomLoadBalance]
account 2019-10-10 17:57:44,015 [DubboServerHandler-10.10.10.130:20880-thread-3] INFO i.s.c.l.EnhancedServiceLoader - load UndoLogParser[jackson] extension by class[io.seata.rm.datasource.undo.parser.JacksonUndoLogParser]
order 2019-10-10 17:57:44,092 [DubboServerHandler-10.10.10.130:20881-thread-4] DEBUG c.n.o.d.T.insert - ==> Preparing: INSERT INTO t_order ( id,order_no,user_id,commodity_code,count,amount ) VALUES( ?,?,?,?,?,? )
order 2019-10-10 17:57:44,092 [DubboServerHandler-10.10.10.130:20881-thread-4] DEBUG c.n.o.d.T.insert - ==> Parameters: 1314691584175899638(Long), bcc9e7739ab340fab5fbdbf58f667a02(String), 1(String), C201901140001(String), 500(Integer), 2000.0(Double)
order 2019-10-10 17:57:44,137 [DubboServerHandler-10.10.10.130:20881-thread-4] DEBUG c.n.o.d.T.insert - <== Updates: 1
business 2019-10-10 17:57:44,164 [DubboServerHandler-10.10.10.130:20883-thread-17] INFO i.s.t.a.DefaultGlobalTransaction - [10.42.1.30:8091:2024332035] commit status:Committed
storage 2019-10-10 17:57:44,657 [rpcDispatch_RMROLE_2_8] INFO i.s.c.r.n.RmMessageListener - onMessage:xid=10.42.1.30:8091:2024332035,branchId=2024332037,branchType=AT,resourceId=jdbc:mysql://10.10.10.233:3306/seata_demo_storage,applicationData=null
storage 2019-10-10 17:57:44,660 [rpcDispatch_RMROLE_2_8] INFO i.s.r.AbstractRMHandler - Branch committing: 10.42.1.30:8091:2024332035 2024332037 jdbc:mysql://10.10.10.233:3306/seata_demo_storage null
storage 2019-10-10 17:57:44,660 [rpcDispatch_RMROLE_2_8] INFO i.s.r.AbstractRMHandler - Branch commit result: PhaseTwo_Committed
account 2019-10-10 17:57:44,673 [rpcDispatch_RMROLE_1_8] INFO i.s.c.r.n.RmMessageListener - onMessage:xid=10.42.1.30:8091:2024332035,branchId=2024332040,branchType=AT,resourceId=jdbc:mysql://10.10.10.233:3306/seata_demo_account,applicationData=null
account 2019-10-10 17:57:44,676 [rpcDispatch_RMROLE_1_8] INFO i.s.r.AbstractRMHandler - Branch committing: 10.42.1.30:8091:2024332035 2024332040 jdbc:mysql://10.10.10.233:3306/seata_demo_account null
account 2019-10-10 17:57:44,676 [rpcDispatch_RMROLE_1_8] INFO i.s.r.AbstractRMHandler - Branch commit result: PhaseTwo_Committed
order 2019-10-10 17:57:44,682 [rpcDispatch_RMROLE_2_8] INFO i.s.c.r.n.RmMessageListener - onMessage:xid=10.42.1.30:8091:2024332035,branchId=2024332043,branchType=AT,resourceId=jdbc:mysql://10.10.10.233:3306/seata_demo_order,applicationData=null
order 2019-10-10 17:57:44,683 [rpcDispatch_RMROLE_2_8] INFO i.s.r.AbstractRMHandler - Branch committing: 10.42.1.30:8091:2024332035 2024332043 jdbc:mysql://10.10.10.233:3306/seata_demo_order null
order 2019-10-10 17:57:44,683 [rpcDispatch_RMROLE_2_8] INFO i.s.r.AbstractRMHandler - Branch commit result: PhaseTwo_Committed

未完待续

后续还有其他几个方面的测试。


转载:https://blog.csdn.net/isea533/article/details/102497681
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场