-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
optimize: optimize the conditions for executing unlocking #3236
optimize: optimize the conditions for executing unlocking #3236
Conversation
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.
GlobalSession.end 里面的那个clean方法也应该要改,那个地方99%的情况下都是不需要clean的。
是的,你是对的,我已经将添加的判断条件移到clean方法中了。 |
Codecov Report
@@ Coverage Diff @@
## develop #3236 +/- ##
=============================================
- Coverage 51.57% 51.12% -0.46%
+ Complexity 3379 3303 -76
=============================================
Files 619 614 -5
Lines 20468 20133 -335
Branches 2563 2516 -47
=============================================
- Hits 10556 10292 -264
+ Misses 8852 8807 -45
+ Partials 1060 1034 -26 |
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.
LGMT
如果globalSession的status是Committing,AsyncCommitting,CommitRetrying的时候,那么GlobalSession#removeBranch的时候,其实也不需要unlock了,因为他在前面的closeAndClean的时候已经把lock都清除了,王良哥看一下要不要在这个pr里面一起处理一下。 |
…itting, CommitRetrying, AsyncCommitting)
… optimize-tcc-global-commit
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.
LGTM changes下2个md文件的pr登记进行补充下
done |
…-tcc-global-commit
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.
LGTM
…-tcc-global-commit # Conflicts: # changes/1.5.0.md # changes/en-us/1.5.0.md
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.
LGTM
Ⅰ. Describe what this PR did
optimize: opt the conditions for executing unlocking.
优化:优化执行解锁的条件,避免不必要的unlock操作。
顺便修复了一个BUG:当TC的
server.rollbackRetryTimeoutUnlockEnable=true
时,如果unlock出现异常,全局事务却删除成功时锁数据会遗留下来。当前PR优化了以下五种情况:
AT
分支时,就不清理锁数据:包含4种情况。1.1. 全局提交刚开始,执行
closeAndClean()
时,没有AT分支就不需要clean()
.1.2. 全局提交或全局回滚完成后,执行
SessionHelper.endXxxxed()
方法时,因为已经没有分支数据了,不需要clean()
。1.3. 当分支返回
PhaseTwo_CommitFailed_Unretryable
或PhaseTwo_RollbackFailed_Unretryable
时,当剩余分支没有AT
分支时,不需要clean()
.1.4. SAGA事务,不需要
clean()
.unlock
.Ⅱ. Does this pull request fix one issue?
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews