-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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: Saga annotation #5300
base: 2.x
Are you sure you want to change the base?
feature: Saga annotation #5300
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## 2.x #5300 +/- ##
======================================
Coverage ? 48.81%
Complexity ? 4251
======================================
Files ? 772
Lines ? 27011
Branches ? 3356
======================================
Hits ? 13185
Misses ? 12444
Partials ? 1382 |
# Conflicts: # tcc/src/main/java/org/apache/seata/rm/tcc/interceptor/TccActionInterceptorHandler.java
46dda92
to
48596a7
Compare
新增seata-saga-annotation模块,继承自seata-tcc,seata-saga-annotation主要是覆盖了tcc的部分逻辑,以适配saga模式。 新建saga注解: 扩展SagaActionInterceptorParser,支持Saga-annotation切面解析器。 扩展SagaActionInterceptorHandler,saga两阶段注解切面,继承自TccActionInterceptorHandler,覆盖重写了类型,参数生成,注解类部分方法。 seata-server扩展SagaAnnotationCore,执行SAGA-ANNOTATION的提交时忽略。 扩展SagaAnnotationResourceManager,继承自TCCResourceManager,二阶段回滚复用tcc逻辑,主要是覆盖了branchCommit,执行空提交方法,实际上TC会忽略SAGA-ANNOTATION的提交过程,不会走到RM端。 |
# Conflicts: # saga/pom.xml # tcc/src/main/java/org/apache/seata/rm/tcc/interceptor/TccActionInterceptorHandler.java
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.x #5300 +/- ##
============================================
+ Coverage 51.01% 51.10% +0.09%
- Complexity 5261 5301 +40
============================================
Files 934 941 +7
Lines 33029 33133 +104
Branches 4002 4002
============================================
+ Hits 16849 16932 +83
- Misses 14511 14531 +20
- Partials 1669 1670 +1
|
支持saga注解的两阶段事务提交方式。
1、saga分支事务也分为两阶段,和tcc类似,区别在于,当saga事务提交时,一阶段直接提交,无需二阶段,即退化了tcc的二阶段提交,只有事务需要回滚时才会执行二阶段对一阶段提交的事务数据进行补偿。
2、新增saga注解CompensationBusinessAction,对需要使用saga模式的分支事务服务接口或者实现添加该注解。
3、由于和tcc流程类似,saga-annotation模式复用了大部分tcc的流程,对其中特殊的地方做了重写。
4、saga注解模式相比状态机暂时不支持向前重试能力。
5、防悬挂可复用tcc防悬挂,当前防悬挂问题另开PR处理。