leezongjie

Results 3 comments of leezongjie

saga失败触发全局回滚事件时,GlobalRollbackRequest,server接收到后判断了如果是saga就将回滚发送给发起者做状态机向前重试或者回退。saga注解这里需要额外注意,目前没有向前重试,发起者又没有对分支做存储,所以可能需要判断下如果是注解,就需要按照tcc部分,给每个分支rm发送分支回滚BranchRollbackRequest。 ![image](https://user-images.githubusercontent.com/18690851/175771455-0df72177-01d7-4a6c-9479-d13df56c45c1.png) ![image](https://user-images.githubusercontent.com/18690851/175771718-01fba9c3-38b1-44e5-9b4b-3811d5723f61.png)

![image](https://github.com/apache/incubator-seata/assets/18690851/39e8a453-663c-4103-b460-6f360d54248b) 主要改动: 原parserInterfaceToProxy切面解析部分保持返回一个ProxyInvocationHandler,内部解析过程将会创建ProxyInvocationHandler拦截器链。 支持添加多个拦截器,可以通过{@link ProxyInvocationHandler#order()}指定切面的进入顺序。 不允许加载多个同类型的拦截器,如tcc和saga的二阶段注解不能同时存在,通过{@link ProxyInvocationHandler#type()}指定类型。

新增seata-saga-annotation模块,继承自seata-tcc,seata-saga-annotation主要是覆盖了tcc的部分逻辑,以适配saga模式。 新建saga注解: ![image](https://github.com/apache/incubator-seata/assets/18690851/768ae2e5-757a-4770-99d2-207553e13148) 扩展SagaActionInterceptorParser,支持Saga-annotation切面解析器。 ![image](https://github.com/apache/incubator-seata/assets/18690851/bf6912bd-4b23-46bf-ac19-8e8fcdca18ea) 扩展SagaActionInterceptorHandler,saga两阶段注解切面,继承自TccActionInterceptorHandler,覆盖重写了类型,参数生成,注解类部分方法。 ![image](https://github.com/apache/incubator-seata/assets/18690851/e6985432-ab5b-4c7f-bafb-a9c0b7ef5fe6) seata-server扩展SagaAnnotationCore,执行SAGA-ANNOTATION的提交时忽略。 ![image](https://github.com/apache/incubator-seata/assets/18690851/6cd4b890-d98d-4f65-ab29-3848c9c9faee) 扩展SagaAnnotationResourceManager,继承自TCCResourceManager,二阶段回滚复用tcc逻辑,主要是覆盖了branchCommit,执行空提交方法,实际上TC会忽略SAGA-ANNOTATION的提交过程,不会走到RM端。 ![image](https://github.com/apache/incubator-seata/assets/18690851/6d6fb219-bb2e-4abc-9c56-0669954d80e4)