-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Conversation
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, |
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.
这里如果是rollbacked应该是 may be TimeoutRollbacked吧?
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.
In the two-phase commit scenario, the transaction state is TimeoutRollbacked.
是指二阶段commit场景下的事务状态是TimeoutRollbacked场景嘛?
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得到的却是finish,那肯定事务是被超时回滚了,因为同步决议时(非超时)只可能返回committ相关状态,如果是只是为了告诉用户事务可能已经回滚完了,那么这个日志看起来没问题.就是看最终表达上是偏向于结果,还是最有可能的状态
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.
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不一定是因为超时回滚导致,但超时回滚绝对是最大的原因。
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.
明白了,那这个日志没问题
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.
看你俩聊了半天,没看懂
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
…pache#5478) Signed-off-by: slievrly <slievrly@163.com>
Ⅰ. 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