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: fix finished transaction swallows exception when committing #5478

Merged
merged 3 commits into from
Apr 3, 2023

Conversation

slievrly
Copy link
Member

@slievrly slievrly commented Mar 30, 2023

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

fix finished transaction swallows exception when committing

Ⅱ. Does this pull request fix one issue?

fix #5468

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Signed-off-by: slievrly <slievrly@163.com>
Signed-off-by: slievrly <slievrly@163.com>
throw new TransactionalExecutor.ExecutionException(tx, exx, code);
Exception statusException = null;
if (GlobalStatus.isTwoPhaseHeuristic(afterCommitStatus)) {
statusException = new TmTransactionException(TransactionExceptionCode.CommitHeuristic,
Copy link
Contributor

Choose a reason for hiding this comment

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

这里如果是rollbacked应该是 may be TimeoutRollbacked吧?

Copy link
Member Author

Choose a reason for hiding this comment

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

In the two-phase commit scenario, the transaction state is TimeoutRollbacked.


是指二阶段commit场景下的事务状态是TimeoutRollbacked场景嘛?

Copy link
Contributor

Choose a reason for hiding this comment

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

是的,就是这个日志是要表示最终是回滚还是说要表示事务最后状态,如果是最后的状态,当一个事务commit得到的却是finish,那肯定事务是被超时回滚了,因为同步决议时(非超时)只可能返回committ相关状态,如果是只是为了告诉用户事务可能已经回滚完了,那么这个日志看起来没问题.就是看最终表达上是偏向于结果,还是最有可能的状态

Copy link
Member Author

Choose a reason for hiding this comment

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

The message that is communicated to the user is that the commit has failed. There are many reasons for this failure, such as storage exceptions, but these exceptions do not define a very fine state to pass to the user.
It's not necessarily the timeout rollback that causes a transaction to commit Finished, but it's definitely the biggest reason.


面向用户传递的信息就是提交失败,失败有很多原因比如存储异常,但是这种异常不会定义非常细的状态透传给用户。
事务提交Finished不一定是因为超时回滚导致,但超时回滚绝对是最大的原因。

Copy link
Contributor

Choose a reason for hiding this comment

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

明白了,那这个日志没问题

Copy link

Choose a reason for hiding this comment

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

看你俩聊了半天,没看懂

@funky-eyes funky-eyes modified the milestones: 1.7.0, 2.0.0 Mar 31, 2023
Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

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

LGTM

@funky-eyes funky-eyes merged commit 43603f6 into apache:2.x Apr 3, 2023
slievrly added a commit to slievrly/fescar that referenced this pull request Apr 26, 2023
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

Successfully merging this pull request may close these issues.

全局事务回滚后,没有抛出任何异常
3 participants