[ 
https://issues.apache.org/jira/browse/SCB-300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16440282#comment-16440282
 ] 

ASF GitHub Bot commented on SCB-300:
------------------------------------

zhfeng commented on issue #173: [SCB-300] acceptance test for @Compensable 
event timeout
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/173#issuecomment-381811623
 
 
   what is the purpose of this test ? I think it would like to show the 
scenario that when the saga transaction is timeout, the alpha server call the 
compensate method is failed and will retry ?
   
   The booking service looks like the following steps:
   1) saga start
   2) call the car booking
   3) call the hotel booking
   4) postBooking wait 10s until the transaction timeout (injected by the 
byteman rules)
   5) return failure message with the information of timeout ( I think it is 
still an issue when we are sending the SAGA_ENDED in the 
https://github.com/apache/incubator-servicecomb-saga/blob/master/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/SagaStartAnnotationProcessor.java#L45).
 I think we should check the return value and throws the Exception if the 
transaction is timeout. Also the alpha server handles the message in 
(https://github.com/apache/incubator-servicecomb-saga/blob/master/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/TxConsistentService.java#L38),
 currently it only check if the transaction is aborted and I think it should 
also check if the transaction is timeout.
   
   For this test, if we want to simulate the alpha server retries the 
compensate method when the transaction is timeout, I think it would like to use 
the byteman rule in the cancel method of HotelBooking 
(https://github.com/apache/incubator-servicecomb-saga/blob/master/saga-demo/booking/hotel/src/main/java/org/apache/servicecomb/saga/demo/pack/hotel/HotelBookingService.java#L40)
   ```
   RULE create counter
   CLASS org.apache.servicecomb.saga.demo.pack.hotel.HotelBooking
   METHOD <init>
   IF TRUE
   DO createCountDown($0, 1)
   ENDRULE
   
   RULE throws the exception when calling the cancel method at the first time
   CLASS org.apache.servicecomb.saga.demo.pack.hotel.HotelBookingService
   MEHTOD cancel(HotelBooking)
   AT ENTRY
   IF !countDown($0)
   DO throw exception
   ENDRULE
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [pack] acceptance tests of transaction timeout and retry
> --------------------------------------------------------
>
>                 Key: SCB-300
>                 URL: https://issues.apache.org/jira/browse/SCB-300
>             Project: Apache ServiceComb
>          Issue Type: Sub-task
>          Components: Saga
>            Reporter: Yin Xiang
>            Assignee: Zheng Feng
>            Priority: Major
>             Fix For: saga-0.2.0
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to