Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
bugfix: modify XA mode pre commit transaction from commit phase to before close phase #7102
base: 2.x
Are you sure you want to change the base?
bugfix: modify XA mode pre commit transaction from commit phase to before close phase #7102
Changes from 7 commits
c159a69
aaa71d8
07611ff
bc2affc
acb9220
86b29b4
18e6b1f
f6f7472
2d1400b
c88c0cf
93c5c4c
73d0ace
f631271
690b73c
976049b
a14e856
e065c53
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个改成false后,如果通过setAutoCommit触发commit时要怎么办?
After changing this to false, what if the commit is triggered by setAutoCommit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里置为false是因为,自动提交事务第二次调用setAutoCommit时,if (xaActive)这里会调用commit方法,currentAutoCommitStatus在第一次被置为false,进入会继续执行end方法就会报错。
现在commit方法的xaActive = false;逻辑已去掉,setAutoCommit新加了一层判断 if (xaActive && !xaEnded)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end后的xa事务应该是可以join的,只要没有进入prepare阶段,如果我手动commit或rollback,再接着发sql,这里被标识成了xaended,如何进行prepare?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
接着发sql最终还是会调用commit方法,xaEnded会被置为true,close时依然会进行prepare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我认为prepare这块的逻辑不需要termination
I don't think the logic of preparing this piece needs termination
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已调整commit从调用xaEnd改为end方法,这里已去掉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果走了rollback的事务不需要prepare,直接上报一阶段失败即可
If the transaction that has gone rollback does not need to be prepared, it can directly report the failure of the first stage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rollback方法的finally会调用cleanXABranchContext,这里会把xaEnded置为false