Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: custom saga transaction recovery strategy on transaction timeout #2240

Merged
merged 15 commits into from
Feb 15, 2020

Conversation

long187
Copy link
Contributor

@long187 long187 commented Feb 11, 2020

Ⅰ. Describe what this PR did

Feature: Custom saga transaction recovery strategy on transaction time out

In some business scenarios, rollback cannot be performed (for example, there is no compensation service configured, or the data modified), We can execute the state machine forward to complete the business process.

The default timeout transaction recovery policy of Seata server is "rollback". When the user configures the transaction recovery policy as "forward" on the state machine definition, Seata server sends a commit retry request to saga client for retry.

Ⅳ. Describe how to verify it

configure "RecoverStrategy" as "Forward" on state machine definition:

{
    "Name": "simpleStateMachineWithRecoverStrategy",
    "StartState": "FirstState",
    "Version": "0.0.1",
    "RecoverStrategy": "Forward",
    "States": {
    }
}

Junit tests at:
seata/test/src/test/java/io/seata/saga/engine/db/StateMachineDBTests#testStateMachineCustomRecoverStrategyOnTimeout
seata/test/src/test/java/io/seata/saga/engine/db/StateMachineDBTests#testStateMachineCustomRecoverStrategyOnTimeoutAsync

@slievrly slievrly added this to the 1.1.0 milestone Feb 11, 2020
@codecov-io
Copy link

codecov-io commented Feb 14, 2020

Codecov Report

Merging #2240 into develop will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #2240      +/-   ##
=============================================
- Coverage      49.95%   49.94%   -0.02%     
  Complexity      2660     2660              
=============================================
  Files            517      518       +1     
  Lines          17004    17011       +7     
  Branches        2021     2022       +1     
=============================================
+ Hits            8495     8496       +1     
- Misses          7679     7684       +5     
- Partials         830      831       +1     
Impacted Files Coverage Δ Complexity Δ
...o/seata/saga/statelang/domain/RecoverStrategy.java 0.00% <0.00%> (ø) 0.00% <0.00%> (?%)

Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slievrly slievrly changed the title Feature: Custom saga transaction recovery strategy on transaction time out feature: custom saga transaction recovery strategy on transaction timeout Feb 14, 2020
Copy link
Contributor

@zhangthen zhangthen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@slievrly slievrly merged commit 769f061 into apache:develop Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants