kaori-seasons opened a new pull request, #651:
URL: https://github.com/apache/incubator-seata-go/pull/651
**BackGround **
The seata saga mode will support multiple usage methods in the future.
1) State machine json: json
2) Streaming orchestration: saga.task(xxx).build().start()
3) TCC-like mode
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**:
- [x] 1. The saga branch transaction is also divided into two phases,
similar to tcc. The difference is that when the saga transaction is submitted,
the first phase is submitted directly.
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.
- [x] 2. Added saga annotation CompensationBusinessAction,
Add this annotation to the branch transaction service interface or
implementation that needs to use the saga mode.
- [x] 3. Because it is similar to the tcc process, the saga-annotation mode
reuses most of the tcc process.
Special aspects have been rewritten.
- [x] 4. Compared with the state machine, the saga annotation mode does not
currently support the forward retry capability.
- [ ] 5. Anti-suspension can be reused with tcc anti-suspension.
- [x] 6. Comparing the action information with tcc, the actions of tcc are
prepare, commit, rollback,
saga is action, compensationAction
**Which issue(s) this PR fixes**:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related
issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #
**Special notes for your reviewer**:
**Does this PR introduce a user-facing change?**:
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires
additional action from users switching to the new release, include the string
"action required".
-->
```release-note
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]