-
Notifications
You must be signed in to change notification settings - Fork 797
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: Integrating SEATA to support distributed transaction in TCC mode #1728
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1728 +/- ##
==========================================
- Coverage 60.98% 60.92% -0.07%
==========================================
Files 380 380
Lines 33447 33450 +3
==========================================
- Hits 20399 20380 -19
- Misses 11064 11081 +17
- Partials 1984 1989 +5
Continue to review full report at Codecov.
|
Is this feature appropriate in layotto? cc @zhenjunMa @seeflood |
IMO,currently it might be inappropiate to integrate it as a runtime API in Layotto.
I haven't read through this pr, and I'm curious in what scenarios does the user want to use TCC via a sidecar? |
这个 pr 拦截代理用户的请求,通过状态码判断是否提交回滚。通过在 sidecar 中集成 TCC,使那些没有 sdk 的语言,如 .net\node,用这些语言写的微服务也能使用 TCC 模式来协调分布式事务。整个过程要抽象成适合 layotto 的 grpc api 比较难,它更适合集成在 mosn 中。用户只需要写他的 TCC 接口,协调工作由 sidecar 完成。交互逻辑见上面贴的动图。 |
@dk-lockdown 噢噢,用户场景是让没有sdk的语言也能用TCC对吧? |
这个是 TC 的工作,TM 发起全局事务提交或者回滚,TC 根据 xid 找到全局事务注册的所有事务分支,通知他们提交或者回滚。所以这个 pr 还需要一个 TC 事务协调器。只用 mosn sidecar 是不能解决分布式事务问题的。 |
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.
lgtm
thanks for your contribution! |
Issues associated with this PR
集成 SEATA TCC 模式,初步实现 TransactionMesh,目前只支持 http1 协议
Solutions
TransactionManager:拦截请求,在请求开始之前,开启全局事务。在分支事务执行完毕,根据状态码,提交全局事务或回滚全局事务。
ResourceManager:拦截请求,在请求开始之前,向事务管理器注册事务分支。在分支事务执行完毕,根据状态码报告分支事务执行状态。