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

TCC过程中Try阶段失败,应该不用执行当前过程的Cancel #28

Closed
liuyb02 opened this issue Aug 23, 2016 · 2 comments
Closed

Comments

@liuyb02
Copy link

liuyb02 commented Aug 23, 2016

例如A调用B ,A执行完Try过程,B执行Try失败。
我理解由于B的Try是本地事务遇到Exception已经rollback了,所以不需要执行cancel流程,只需要执行A的cancel即可。但是目前的框架还是会同时执行B的cancel和A的cancel,是不是控制上不太对?

@changmingxie
Copy link
Owner

@liuyb02 框架确实是设计成会执行B的Cancel方法,主要原因是 Try方法的实现是业务自己实现,可能会有多个事务执行,或是多个持久化操作,并没有限制只能在一个本地事务里,所以,如果在执行了一半时异常了,就有cancel的需要;在cancel方法里,业务可根据当前数据来决定如何rollback(比如,不用rollback)。另外,cancel方法和confirm方法需要保持幂等性。

@nhxx
Copy link

nhxx commented Mar 27, 2018

B执行失败,可以不去rollback,rollback逻辑放在cancel里去做

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

3 participants