Uploaded image for project: 'Apache ServiceComb'
  1. Apache ServiceComb
  2. SCB-1707

Forward compensation only sends once a failure event if multiple retries fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • pack-0.6.0
    • Saga
    • None

    Description

      Forward compensation will retry after the call fails until the maximum number of retries is exceeded. It calls the reverse compensate applyTo method with each retry. This will cause multiple TxStartedEvent and TxAbortEvent to be sent. Test case [1] proves this.
       
      For example, retries=2, the first failure, and the second success, Alpha will receive the following events
       
      TxStartedEvent-tx1 (first)
      TxAbortEvent-tx1(This will trigger the compensation operation)
      TxStartedEvent-tx1 (second)
      TxEndedEvent-tx1 (tx1 will be submitted)
       
      I suggest sending the TxAbortEvent event only if the last forward retry failed. The modified event list looks as follows
       
      Example 1: retries=3 and retry all failed
       
      TxStartedEvent-tx1
      TxStartedEvent-tx1
      TxStartedEvent-tx1
      TxAbortEvent-tx1(Trigger compensation operation)
       
      Example 2: retries=3 and last retry succeeded
       
      TxStartedEvent-tx1
      TxStartedEvent-tx1
      TxStartedEvent-tx1
      TxEndedEvent-tx1 
      [1] https://github.com/apache/servicecomb-pack/blob/133a2fa7247b2ba00a380762a38369849390560e/omega/omega-transaction/src/test/java/org/apache/servicecomb/pack/omega/transaction/TransactionAspectTest.java#L309 tx/src/test/java/org/apache/servicecomb/pack/omega/transaction/spring/TransactionInterceptionTest.java#L199
       
      [3] https://github.com/apache/servicecomb-pack/blob/133a2fa7247b2ba00a380762a38369849390560e/omega/omega-transaction/src/test/java/org/apache/servicecomb/pack/omega/transaction/TransactionAspectTest.java#L353
       

      Attachments

        Issue Links

          Activity

            People

              zhanglei Lei Zhang
              zhanglei Lei Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m