-
Notifications
You must be signed in to change notification settings - Fork 285
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 return of Commit and Rollback #595
Conversation
commit or rollback success,but ctx error happens, should not return "failed"
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## master #595 +/- ##
=======================================
Coverage 37.08% 37.08%
=======================================
Files 172 172
Lines 11616 11616
=======================================
Hits 4308 4308
Misses 6944 6944
Partials 364 364
|
@luweiqianyi 展开描述下这个问题的复现步骤和实际影响? |
@luweiqianyi Expand and describe the reproduction steps and actual impact of this problem? |
I used the main method of the file in this link "https://github.com/seata/seata-go-samples/blob/main/tcc/local/cmd/local.go" as the test script, and passed it to tm.WithGlobalTx a ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) ctx, and simulated "Successful submission, but ct x error”, for the Commit function, submitting the global commit request is indeed successful, at this time err=nil, but the original code before modification will return send global commit request failed, is it unreasonable, and Rollback also has the same problem |
|
|
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.
这个修改应该不太对,建议业务调用方设置合理的超时时间。
如果是bf.Ongoing()调用时ctx超时,全局事务提交的请求就不会发送出去,此时err也不为nil。按照你修改后的判断逻辑,将会打印success的日志,明显是不对的。
Co-authored-by: georgehao <[email protected]>
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
commit or rollback success,but ctx error happens, should not return "failed"
What this PR does: commit or rollback success,but ctx error happens
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: yes