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

optimize: handing saga transaction timeout #2215

Merged
merged 8 commits into from
Feb 7, 2020

Conversation

long187
Copy link
Contributor

@long187 long187 commented Jan 20, 2020

Ⅰ. Describe what this PR did

When a transaction timeout occurs, the server will keep sending "rollback requests":

  • How to tell if the Saga transaction has timed out? Determine whether the time of stateMachineInstance.gmtUpdated exceeds the timeout period

  • Timeouts are:
         * Timeout due to application crashed
         * Timeout occurred due to message congestion during asynchronous execution
         * Synchronous execution time is too long
         * Asynchronous execution time is too long

  • Handing timeout:
         1. When the server retries, the state machine determine whether the Saga transaction has timed out. If there is no timeout, the execution is rejected. If the timeout expires, the execution is allowed.
         2. Before each service is executed, determines whether the Saga transaction has timed out. If it times out, stop execution directly and wait for the server to retry.

Ⅳ. Describe how to verify it

seata/test/src/test/java/io/seata/saga/engine/db/StateMachineDBTests.java

method testStateMachineTransTimeout and testStateMachineTransTimeoutAsync

@zjinlei zjinlei added this to the 1.1.0 milestone Jan 22, 2020
@codecov-io
Copy link

codecov-io commented Jan 23, 2020

Codecov Report

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

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #2215      +/-   ##
=============================================
- Coverage      53.92%   53.92%   -0.01%     
  Complexity      2620     2620              
=============================================
  Files            490      490              
  Lines          15346    15350       +4     
  Branches        1751     1752       +1     
=============================================
+ Hits            8276     8277       +1     
- Misses          6288     6291       +3     
  Partials         782      782              

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

@long187 long187 merged commit ea5d381 into apache:develop Feb 7, 2020
booogu pushed a commit to booogu/seata that referenced this pull request Feb 12, 2020
* handing saga transaction timeout

* handing saga transaction timeout

Co-authored-by: xingfudeshi <xingfudeshi@vip.qq.com>
Co-authored-by: Xin Wang <xin.victorwang@gmail.com>
Co-authored-by: zjinlei <75718677@qq.com>
@wangliang181230 wangliang181230 added mode: SAGA SAGA transaction mode and removed area/Saga labels Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mode: SAGA SAGA transaction mode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants