Skip to content
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

【选型类问题】tx-lcn 和 easyTransaction #127

Open
belugaliu opened this issue Jul 9, 2019 · 3 comments
Open

【选型类问题】tx-lcn 和 easyTransaction #127

belugaliu opened this issue Jul 9, 2019 · 3 comments

Comments

@belugaliu
Copy link

belugaliu commented Jul 9, 2019

我提的不是bug的问题,而是针对作者:https://www.cnblogs.com/skyesx/p/10041923.html。中关于tx-lcn,认为的无法保证最终一致性的疑问。
前提:我看过了tx-lcn的部分代码。
问题:1. 应用Crash之后,tx-lcn 无法保证最终一致性,是因为它的最终通知事务组流程,以及TM通知TC,这两个环节任何一个环节在重试次数内都无法到达导致的数据不一致吗?
2. 对于上诉问题,easy-transaction 是怎么解决的呢?

@skyesx
Copy link
Contributor

skyesx commented Jul 11, 2019

  • 不是,文章里指代的是在LCN模式(现在tx-lcn与ET一样加了很多其他模式)里,存在Crash时无法达到最终一致的可能性
  • LCN模式不能达到最终一致的场景是COMMIT阶段时,当某些库提交了,但某些未提交的库对应的应用Crash时(连接会释放,事务会回滚),会导致不一致
  • 同时上面Crash所导致的不一致,不一定能通过补偿修复(例如锁定了钱,crash后被解锁了,然后被用掉了)

@belugaliu
Copy link
Author

belugaliu commented Jul 18, 2019

  • 这个问题不记录修改前的数据,是不是都存在Crash后无法一致的问题。比如阿里的GTS
  • 而且,我看EasyTransaction给的例子是TCC,而TCC方式我觉得对已经运行的系统改动量较大,代码侵入性强。应该不是唯一/推荐/默认选项吧?

@skyesx
Copy link
Contributor

skyesx commented Jul 19, 2019

  • GTS会在二阶段未结束时,保持一个GTS层次的行锁,只要记录通过GTS管控操作,都不会被其他事务修改到,因此能保证最终的一致
  • 关于这个问题,可参考 https://www.cnblogs.com/skyesx/p/9697817.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants