当前位置:网站首页>两阶段提交与三阶段提交
两阶段提交与三阶段提交
2022-07-27 14:11:00 【华为云】
两阶段提交与三阶段提交
两阶段提交
上篇文章中我们说到两阶段提交2pc,两阶段提交还是有很多缺点的,它可能因为网络问题导致数据不一致,比如协调者发送的提交事务的请求由于网络问题只有部分参与者能接收到,这样部分参与者提交了事务而另一部分参与者没有提交就造成了数据的不一致,第二个问题就是协调者如果挂掉,参与者既没有提交也没有回滚,第三个问题就是同时在执行的时候参与节点的服务都是阻塞的,不能对外提供服务
三阶段提交
那么什么是三阶段提交,三阶段提交能否能解决这些问题呢?
三阶段提交分为CanCommit阶段,PreCommit阶段和doCommit阶段。第一个阶段是检查自身状态是否满足了事务操作的条件,一般可能是首先获取到这个分布式事务的锁,第二个阶段就是开始事务,但是没有提交,并返回给协调者结果,第三个阶段就是对事务的提交或回滚。
这就是三阶段提交的大致内容,那么三阶段提交是否解决了两阶段提交产生的问题呢?三阶段提交参与者也有超时机制,在preCommit的时候,如果收不到协调者的消息会执行中断事务,在doCommit阶段如果迟迟收不到协调者的消息就会进行事务提交,而数据的一致性问题和协调者的单点故障问题依然存在
总结
两阶段提交和三阶段提交都会存在一定的问题,三阶段提交相对二阶段提交多了参与者的超时机制,但剩余问题并没有得到解决,比如数据的一致性和协调者的单点故障的问题。
️ 感谢大家
如果你觉得这篇内容对你挺有有帮助的话:
- 欢迎关注我️,点赞,评论,转发
- 关注
盼盼小课堂,定期为你推送好文,还有群聊不定期抽奖活动,可以畅所欲言,与大神们一起交流,一起学习。
边栏推荐
- Graphic SQL of giant image
- Skywalking distributed system application performance monitoring tool - medium
- Is it safe for Guosen Securities to open a mobile account? Is Zhongshan securities reliable
- How to help enterprises optimize office management
- 【云享读书会第13期】视频文件的封装格式
- FPGA时序约束分享04_output delay 约束
- HDU3117 Fibonacci Numbers【数学】
- NEFU119 组合素数【算术基本定理】
- 资本频频加码,急于上市的和府捞面有多“疯狂”?
- STM32F103C8T6在Arduino框架下驱动ssd1306 0.96“ IIC OLED显示
猜你喜欢

STM32 - capacitive touch button experiment

【ManageEngine】什么是SIEM

Construction and empirical research of post talent demand analysis framework based on recruitment advertisement

Idea makes jar packages and introduces jar packages

面试官问:如何判断一个元素是否在可视区域?

Jmeter录制接口自动化

Passive income: return to the original and safe two ways to earn

adb命令 (安装apk包格式:adb install 电脑上apk地址包名)
![[work] about technical architecture](/img/24/f3402c04157ce9a8846580f017f472.png)
[work] about technical architecture

电子制造行业的数字化转型突破点在哪?精益制造是关键
随机推荐
Understand the evolution of redis architecture in one article
Construction of knowledge map of financial securities and discovery of related stocks from the perspective of knowledge relevance
LeetCode 240. 搜索二维矩阵 II medium
如何帮助企业优化Office管理
网络设备硬核技术内幕 路由器篇 (10) CISCO ASR9900拆解 (四)
LeetCode 81. 搜索旋转排序数组 II 二分/medium
多表查询_练习1&练习2&练习3
网络设备硬核技术内幕 路由器篇 15 从鹿由器到路由器 (下)
Lecture 4: Longest ascending substring
视觉系统设计实例(halcon-winform)-10.PLC通讯
@What happens when bean and @component are used on the same class?
Regular expressions: mailbox matching
[ManageEngine] what is Siem
adb命令 (安装apk包格式:adb install 电脑上apk地址包名)
【医疗行业】DICOM converter Tools
DXGI acquisition process
What is the execution method of the stand-alone parallel query of PostgreSQL?
Nokia's patent business was hit for the first time, and Chinese enterprises are not so easy to knead
炒黄金开户平台有没有正规,安全的
国信证券手机开户安全吗 中山证券靠谱吗