当前位置:网站首页>Seata submits at details in two stages
Seata submits at details in two stages
2022-07-26 05:04:00 【On knowledge】
Seata Two-phase commit
And traditional 2PC The model of is similar to ,Seata Defined 3 Components to coordinate the processing of distributed transactions 
- Transaction Coordinator(TC): Transaction coordinator , It's independent middleware , Need to deploy independently to run , It maintains the running state of global transactions , receive TM Instruction initiated commit and rollback , Responsible for working with RM Communication coordinates the submission or rollback of branch transactions .
- Transaction Manager(TM): Transaction manager ,TM Need to be embedded and work in the application , It is responsible for opening a global transaction , And finally to TC An instruction to initiate a global commit or global rollback .
- Resource Manager(RM): Control branch transactions , Responsible for branch registration , Status report , And receive the transaction coordinator TC Instructions , Drive branch ( Local ) Transaction commit and rollback .
The evolution of the two-stage submission agreement :
A stage : Business data and rollback logging are committed in the same local transaction , Release local locks and connection resources .
Two stages :
Submit asynchronized , Complete... Very quickly .
Rollback is compensated by a phase of rollback log
List of new user registration points Seata Distributed transaction process :

The specific implementation process is as follows :
1. User service TM towards TC Request to open a global transaction , The global transaction is created successfully, and a globally unique XID.
2. User service RM towards TC register Branch business , The branch transaction performs the new user logic in the user service , And include it in XID Jurisdiction corresponding to global transaction .
3. The user service performs branch transactions , Insert a record into the user table .
4. When the logic is executed to call the integration service remotely (XID Propagate in the context of the microservice call link ). Points service RM towards TC Register branch transactions , This branch transaction performs the logic of increasing integral , And include it in XID Jurisdiction corresponding to global transaction .
5. The points service performs branch transactions , Insert a record into the score sheet , After execution , Return to user service .
6. User service branch transaction execution completed .
7.TM towards TC Launch against XID The global commit or rollback resolution for .
8.TC Dispatch XID All branch transactions under the jurisdiction of complete the commit or rollback transaction request .
Seata Realization 2PC With the traditional 2PC The difference between
- Architecture level , Tradition 2PC Of the plan RM It's actually in the database layer ,RM Essentially, it's the database itself , adopt XA Protocol implementation , and Seata Of RM In order to jar The package is deployed on the application side as a middleware layer .
- Two phase submission , Tradition 2PC No matter the resolution of the second stage is commit still rollback, The locks of transactional resources should be kept to Phase2 Release when finished . and Seata The way to do this is to Phase1 Commit local transaction , This will save Phase2 Time to hold lock , Improve overall efficiency .
边栏推荐
- Nacos 介绍和部署
- Tonight! Stonedb is officially open source. Please check this strategy~
- The first open source MySQL native HTAP database in China will be released soon! Look at the three highlights first, limited to the surrounding areas, waiting for you~
- What are the demand management software for small and medium-sized enterprises
- Switch and router technology: dynamic routing protocol, rip routing protocol and OSPF routing protocol
- “双碳”目标下资源环境中的可计算一般均衡(CGE)模型实践技术
- Database startup message: ora-29702: error occurred in cluster group service
- Ggjj, do you have a look at this problem? Does caching cause cross domain problems?
- Ansible tutorial
- [cloud native | 17] four network modes of container
猜你喜欢

Minipcie interface can card solves the problem of industrial computer expanding can channel minipcie can

Good at C (summer vacation daily question 6)

滑动窗口——leetcode题解

ES6 modularization +commonjs

Mysql主从同步及主从同步延迟解决方案

columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by mysql8.0解决办法

提高shuffle操作中的reduce并行度
![[semantic segmentation] 2018-deeplabv3+ ECCV](/img/c9/d1e2d7e63df8db2a7fa2bde31b10f7.png)
[semantic segmentation] 2018-deeplabv3+ ECCV

擅长C(暑假每日一题 6)

BigDecimal 的 4 个坑,你踩过几个?
随机推荐
遥感、GIS和GPS技术在水文、气象、灾害、生态、环境及卫生等领域中的应用
What is the difference between asynchronous and synchronous transmission signals (electronic hardware)
Redis解决库存超卖问题
JVM第二讲:类加载机制
Please elaborate on the implementation principle of synchronized and related locks
C语言——字符串函数,内存函数集锦以及模拟实现
STM32 development | ad7606 parallel multi-channel data acquisition
Five simple and practical daily development functions of chrome are explained in detail. Unlock quickly to improve your efficiency!
你对“happen-before原则”的理解可能是错的?
汉字风格迁移篇---通过生成对抗网络学习一对多程式化汉字的转换和生成
What are the characteristics of the grammar of Russian documents in the translation of scientific papers
AQS唤醒线程的时候为什么从后向前遍历,我懂了
有ggjj看看这个问题没,是否缓存导致跨域问题?
vector详解和迭代器失效问题
基于遥感解译与GIS技术环境影响评价图件制作
Study of const of constant function
[Luogu] p3919 [template] persistent segment tree 1 (persistent array)
minipcie接口CAN卡解决工控机扩展CAN通道的难题 minipcie CAN
公交站间的距离 : 简单模拟题
5个chrome简单实用的日常开发功能详解,赶快解锁让你提升更多效率!