暂无图片
mysql xa 一致性疑问
我来答
分享
Mountain
2020-03-05
mysql xa 一致性疑问

2pc,在第一阶段,tm发送prepare到所有参与分布式事务的rm询问是否可以提交操作,参与分布式事务的所有rm接收到请求,实现自身事务提交前的准备工作并返回结果。第二阶段,根据rm返回的结果,如果涉及分布式事务的所有rm都返回可以提交,则tm给rm发送commit命令,每个rm实现自己的提交,同时释放资源,然后rm反馈提交成功,tm完成整个事务。
请问,
如果tm给rm发送commit命令时,其中一个rm没收到(网络故障等原因),结果会怎么样?
或者,rm反馈提交成功时,其中一个rm没反馈或者反馈失败,然后,事务流程怎么走?

我来答
添加附件
收藏
分享
问题补充
3条回答
默认
最新
外包DBA

在用分库分表?
如果tm给rm发送commit命令时,其中一个rm没收到(网络故障等原因),结果会怎么样?
rm反馈提交成功时,其中一个rm没反馈或者反馈失败,然后,事务流程怎么走?
roll back
(参考In the second phase, the TM tells the RMs whether to commit or roll back. If all branches indicated when they were prepared that they will be able to commit, all branches are told to commit. If any branch indicated when it was prepared that it will not be able to commit, all branches are told to roll back.)

https://dev.mysql.com/doc/refman/5.7/en/xa.html
https://dev.mysql.com/doc/refman/5.7/en/xa-restrictions.html

暂无图片 评论
暂无图片 有用 0
打赏 0
Mountain

谢谢wayne,可能没看清我的问题。感谢提供的资料。
XA transactions are not fully resilient to an unexpected halt with respect to the binary log. If there is an unexpected halt while the server is in the middle of executing an XA PREPARE, XA COMMIT, XA ROLLBACK, or XA COMMIT … ONE PHASE statement, the server might not be able to recover to a correct state, leaving the server and the binary log in an inconsistent state. In this situation, the binary log might either contain extra XA transactions that are not applied, or miss XA transactions that are applied. Also, if GTIDs are enabled, after recovery @@GLOBAL.GTID_EXECUTED might not correctly describe the transactions that have been applied. Note that if an unexpected halt occurs before XA PREPARE, between XA PREPARE and XA COMMIT (or XA ROLLBACK), or after XA COMMIT (or XA ROLLBACK), the server and binary log are correctly recovered and taken to a consistent state.
这段可能更能解答。
请问,是不是说xa处理不了第二阶段的异常?

暂无图片 评论
暂无图片 有用 0
打赏 0
外包DBA

我理解也是mysql xa处理不了,其他分布式数据库就不知道了~

暂无图片 评论
暂无图片 有用 0
打赏 0
回答交流
Markdown


请输入正文
提交
相关推荐
mysql批处理,能不能把结果集存在@变量里?
回答 1
已采纳
使用cursor存储结果集,然后遍历cursor使用
mysql从库大量死锁怎么排查?
回答 1
已采纳
showengineinnodbstatus,里面会有最新的记录的。
mysql怎么自定义执行时长?
回答 2
selectsleep(n)fromtable?  值得注意的是。这个执行时间 是n记录数。
MySQL的复制原理?
回答 1
已采纳
MySQL的复制原理:Master上面事务提交时会将该事务的BinlogEvents写入Binlog文件,然后Master将BinlogEvents传到Slave上面,Slave应用该BinlogEv
MySQL json.loads和json.dumps有什么区别?
回答 1
您是想问mysql里的方法,还是python里的mysql操作方法呢?如果是想问mysqlshell的相关操作可以参考这篇文档11.6DumpLoadingUtility
MySQL8.0搭建MGR,启动失败
回答 2
已采纳
看日志是groupreplicationgroupname参数不一致导致的,你看看其他节点这个参数的设置
MySQL 如何从 DUMP 备份的SQL 里获取某个表的数据?
回答 7
从备份文件中直接筛选,也是一个简单便捷的方法
MySQL新建一个触发器报错:1064
回答 1
这个报语法错误。ifthen这里不对。另外推荐不要使用触发器。
mysql 的close table 时 需要把 本表的脏数据 都先刷会磁盘吗?执行flush table时
回答 1
会的。
MYSQL 聚集索引存储 比如说有个订单表每个月有200万个订单,其中有100个订单为取消支付的状态。假如我把这100万给删除了, 会不会加快查询的速度?
回答 1
理论是上可以加快查询速度的,但是删除取消支付不符合业务要求;购物订单有一个付款倒计时,不知道这个倒计时结束是否会有删除取消支付的操作。