-
Notifications
You must be signed in to change notification settings - Fork 278
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
feat: saga's tcc-like mode #651
base: feature/saga
Are you sure you want to change the base?
feat: saga's tcc-like mode #651
Conversation
Have we ever discussed about this feature anywhere? I think we should launch a review meeting to discuss about it. |
BTW, code comments should be re-written in English. Plz check. |
@ptyin |
Quality Gate failedFailed conditions |
@@ -18,6 +18,7 @@ | |||
package client | |||
|
|||
import ( | |||
"github.com/seata/seata-go/pkg/rm/saga" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
格式不对,挪到第三课 import 里面
@@ -0,0 +1,45 @@ | |||
package fence | |||
|
|||
import ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
格式太乱了
@@ -0,0 +1,166 @@ | |||
package handler | |||
|
|||
import ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format 下,乱
@@ -0,0 +1,216 @@ | |||
package saga | |||
|
|||
import ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format 下,乱
@@ -0,0 +1,216 @@ | |||
package saga |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
代码加下 apache license header
@@ -0,0 +1,204 @@ | |||
package saga | |||
|
|||
import ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 添加 apache license header;
2 format import 代码块
@@ -0,0 +1,281 @@ | |||
package saga |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 添加 apache license header;
2 format import 代码块
@@ -0,0 +1,221 @@ | |||
package rm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 添加 apache license header;
2 format import 代码块
3 注释不要用中文
@@ -0,0 +1,16 @@ | |||
package testdata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 添加 apache license header;
2 format import 代码块
BackGround
The seata saga mode will support multiple usage methods in the future.
The saga in seata java is implemented based on the state machine.
1) 2) are all implemented based on the state machine engine, 3) can exist independently of the state machine engine. It is completely independent coding of the business and does not require understanding of the state machine process.
The intention of this PR is to support 3) mode
Equivalent to the Saga state machine mode (1), no matter if the user writes a transaction operation, it will always only include ordinary transaction operations based on the transaction type (ServiceTask, choice action)
And compensation transaction operation (compensation), so the tcc-like mode is equivalent to the degraded version of tcc, without the prepare process.
In the first stage, positive/negative transaction operations are directly submitted without waiting. In the second stage, transaction compensation operations will only occur during rollback.
What this PR does:
There is no need for two-phase submission, which means that the two-phase commit of tcc is degraded and will only be executed when the transaction needs to be rolled back.
The second phase compensates the transaction data submitted in the first phase.
Add this annotation to the branch transaction service interface or implementation that needs to use the saga mode.
Special aspects have been rewritten.
saga is action, compensationAction
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: