Seata 分佈式事務功能測試(一)

基礎代碼參考: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

未完待續

後續還有其他幾個方面的測試。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章