You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@servicecomb.apache.org by "Lei Zhang (Jira)" <ji...@apache.org> on 2020/01/07 15:00:01 UTC
[jira] [Created] (SCB-1707) Forward compensation only sends once a
failure event if multiple retries fail
Lei Zhang created SCB-1707:
------------------------------
Summary: Forward compensation only sends once a failure event if multiple retries fail
Key: SCB-1707
URL: https://issues.apache.org/jira/browse/SCB-1707
Project: Apache ServiceComb
Issue Type: Bug
Components: Saga
Reporter: Lei Zhang
Assignee: Lei Zhang
Fix For: pack-0.6.0
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|https://github.com/apache/servicecomb-pack/blob/a8b24100a59a8ec9c917f89b1aa6978cc81e10df/omega/omega-spring-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]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)