kezhenxu94 commented on issue #2714: [WIP]Seata Agent
URL: https://github.com/apache/skywalking/pull/2714#issuecomment-498004526
 
 
   > @kezhenxu94 The rollback trace is not very clear to me. Could you explain 
more? In your scenario, which service triggers the rollback? I expect you could 
show the trace, one service fails, then TM/TC works together to make other 
services rollback too.
   
   yes I'll elaborate more on this, in this example:
   
   ```java
       @Override
       @GlobalTransactional(timeoutMills = 300000, name = "dubbo-demo-tx")
       public void purchase(String userId, String commodityCode, int 
orderCount) {
           LOGGER.info("purchase begin ... xid: " + RootContext.getXID());
           storageService.deduct(commodityCode, orderCount);
           if (orderCount % 2 == 0) {
               throw new IllegalArgumentException("xxx");
           }
       }
   ```
   
   - the `business.purchase` throws exception after calling 
`storageService.deduct` but before finished the global transaction
   
   - the exception triggers the `TransactionManager` (TM) to request (from TC) 
a rollback
   
   - the `TransactionCoordinator` (TC) requests all the `ResourceManager`s to 
roll back
   
   below the highlighted span is where the `RM` does the rollback operation (by 
doing some compensative operations) as the `TC` demanded
   
   
![image](https://user-images.githubusercontent.com/15965696/58757719-c66f5980-8543-11e9-9603-2ae9b64953c7.png)
   
![image](https://user-images.githubusercontent.com/15965696/58757726-ea329f80-8543-11e9-887e-feb3d98e9e03.png)

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to