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

bugfix: can't post TimeoutRollbacked event #4780

Merged
merged 20 commits into from Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion changes/en-us/develop.md
Expand Up @@ -7,7 +7,8 @@ Add changes here for all PR submitted to the develop branch.


### bugfix:

- [[#4780](https://github.com/seata/seata/pull/4780)] fix can‘t post TimeoutRollbacked event
funky-eyes marked this conversation as resolved.
Show resolved Hide resolved


### optimize:
- [[#4774](https://github.com/seata/seata/pull/4774)] optimize mysql8 dependencies for seataio/seata-server image
Expand All @@ -19,6 +20,7 @@ Thanks to these contributors for their code commits. Please report an unintended

<!-- Please make sure your Github ID is in the list below -->
- [slievrly](https://github.com/slievrly)
- [tuwenlin](https://github.com/tuwenlin)


Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
3 changes: 2 additions & 1 deletion changes/zh-cn/develop.md
Expand Up @@ -6,7 +6,7 @@


### bugfix:

- [[#4780](https://github.com/seata/seata/pull/4780)] 修复监控无法触发 TimeoutRollbacked 事件
funky-eyes marked this conversation as resolved.
Show resolved Hide resolved

### optimize:
- [[#4774](https://github.com/seata/seata/pull/4774)] 优化 seataio/seata-server 镜像中的 mysql8 依赖
Expand All @@ -19,5 +19,6 @@

<!-- 请确保您的 GitHub ID 在以下列表中 -->
- [slievrly](https://github.com/slievrly)
- [tuwenlin](https://github.com/tuwenlin)

同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
Expand Up @@ -379,7 +379,7 @@ protected void handleRetryRollbacking() {
return;
}
rollbackingSession.addSessionLifecycleListener(SessionHolder.getRootSessionManager());
core.doGlobalRollback(rollbackingSession, true);
core.doGlobalRollback(rollbackingSession, !rollbackingSession.getStatus().equals(GlobalStatus.TimeoutRollbacking));
funky-eyes marked this conversation as resolved.
Show resolved Hide resolved
} catch (TransactionException ex) {
LOGGER.info("Failed to retry rollbacking [{}] {} {}", rollbackingSession.getXid(), ex.getCode(), ex.getMessage());
}
Expand Down
Expand Up @@ -180,6 +180,7 @@ public static void endRollbacked(GlobalSession globalSession, boolean retryGloba
beginTime, retryBranch);
} else {
if (SessionStatusValidator.isTimeoutGlobalStatus(globalSession.getStatus())) {
globalSession.changeGlobalStatus(GlobalStatus.Rollbacking);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经是rollbacking status的是否会进这里?如果会是否存在重复修改?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

进到这个满足几个条件,retry是false,且stauts是TimeoutRollbacked,TimeoutRollbackFailed,TimeoutRollbacking,TimeoutRollbackRetrying,也就是说,只有因为超时回滚的相关status且非重试才会走到这,只有TimeoutRollbacking的情况下,retry才是false,其他情况下都是true(至少我没发现其他超时相关status且retry是false的情况,DefaultCoordinator的382行做了限制),应该不会存在重复修改

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to remove the globalSession(status=TimeoutRollbacking)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在SessionHelper的183行,TimeoutRollbacking的session被改成了Rollbacking,2分30秒后被handleRetryCommitting删掉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the flow of transaction state reasonable?

TimeoutRollbacking -> Rollbacking Because you want to delete it?

MetricsPublisher.postSessionDoneEvent(globalSession, GlobalStatus.TimeoutRollbacked, false, false);
} else {
MetricsPublisher.postSessionDoneEvent(globalSession, GlobalStatus.Rollbacked, false, false);
Expand Down
Expand Up @@ -172,7 +172,7 @@ public void test_handleRetryRollbackingTimeOut() throws TransactionException, In
ReflectionUtil.modifyStaticFinalField(defaultCoordinator.getClass(), "MAX_ROLLBACK_RETRY_TIMEOUT", Duration.ofMillis(10));
ReflectionUtil.modifyStaticFinalField(defaultCoordinator.getClass(), "ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE", false);
TimeUnit.MILLISECONDS.sleep(100);
defaultCoordinator.timeoutCheck();
globalSession.queueToRetryRollback();
defaultCoordinator.handleRetryRollbacking();
int lockSize = globalSession.getBranchSessions().get(0).getLockHolder().size();
try {
Expand Down Expand Up @@ -200,7 +200,7 @@ public void test_handleRetryRollbackingTimeOut_unlock() throws TransactionExcept
ReflectionUtil.modifyStaticFinalField(defaultCoordinator.getClass(), "ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE", true);
TimeUnit.MILLISECONDS.sleep(100);

defaultCoordinator.timeoutCheck();
globalSession.queueToRetryRollback();
defaultCoordinator.handleRetryRollbacking();

int lockSize = globalSession.getBranchSessions().get(0).getLockHolder().size();
Expand Down