-
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
bugfix: set time threshold for transactions in committing state #3560
Conversation
Rollbacking的状态下的事务,如果超过了设定的阈值,会被重试的,这里我觉得应该是只处理Commiting状态 |
@caohdgege 那这块是不就能照 rollbacking 的来写了,同样也设置一个阈值 |
如果要仿照rollbacking来写的话,可以参考 DefaultCoordinator#handleRetryRollbacking 中的实现。 |
在 changes/ 文件夹下面的两个md中登记一下自己和这个pr |
@caohdgege OK🙆 |
Codecov Report
@@ Coverage Diff @@
## develop #3560 +/- ##
=============================================
- Coverage 51.95% 51.94% -0.01%
Complexity 3481 3481
=============================================
Files 637 637
Lines 21064 21067 +3
Branches 2610 2611 +1
=============================================
Hits 10944 10944
- Misses 9037 9040 +3
Partials 1083 1083
|
server/src/main/java/io/seata/server/coordinator/DefaultCoordinator.java
Outdated
Show resolved
Hide resolved
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
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
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
当 TC 驱动 RM 提交事务时,如果在 doGlobalCommit 时数据库宕机,异常被捕获,此时会将事务添加到retry 的 sessionMenager 中,等待 retry 定时任务来处理,但是由于数据库宕机,数据库中事务的状态无法被修改,一直保持 Commiting 状态。retry 定时任务将不会处理该状态的事务。
Ⅱ. Does this pull request fix one issue?
fixes #3558
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews
参考了
DefaultCoordinator#handleRetryRollbacking
中的实现。在
DefaultCoordinator#handleRetryCommitting
中把 committing 状态的全局事务也查出来,然后判断是否是 isDeadSession 。判断依据是(System.currentTimeMillis() - beginTime) > (2 * 6000);