You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "knyk-dev (via GitHub)" <gi...@apache.org> on 2026/03/26 10:29:33 UTC
[PR] fix: rollback auto-created AT tx on query and exec errors [incubator-seata-go]
knyk-dev opened a new pull request, #1083:
URL: https://github.com/apache/incubator-seata-go/pull/1083
<!-- Thanks for sending a pull request!
-->
<!-- Please make sure you have read and understood the contributing guidelines -->
- [ ] I have registered the PR `https://github.com/apache/incubator-seata-go/tree/master/changes` .
**What this PR does**:
- fix the AT auto-commit helpers so a local transaction created by `BeginTx()` is rolled back when the wrapped Exec or Query callback returns an error
- add regression tests for both `createTxAndExecIfNeeded()` and `createTxAndQueryIfNeeded()`
**Which issue(s) this PR fixes**:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #1082
**Special notes for your reviewer**:
The bug is in the error path after `BeginTx()` succeeds.
Both helpers returned `err` directly when `f()` failed, so the auto-created local transaction was left open unless the code panicked. This PR rolls back the created transaction before returning the execution error.
The change is intentionally small and only touches the two helper paths plus regression tests.
**Does this PR introduce a user-facing change?**:
```release-note
fix: roll back auto-created local AT transactions when exec or query returns an error
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] fix: rollback auto-created AT tx on query and exec errors [incubator-seata-go]
Posted by "thunguo (via GitHub)" <gi...@apache.org>.
thunguo merged PR #1083:
URL: https://github.com/apache/incubator-seata-go/pull/1083
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] fix: rollback auto-created AT tx on query and exec errors [incubator-seata-go]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #1083:
URL: https://github.com/apache/incubator-seata-go/pull/1083#issuecomment-4133474693
## [Codecov](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1083?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `50.00000%` with `5 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 57.00%. Comparing base ([`2cce81b`](https://app.codecov.io/gh/apache/incubator-seata-go/commit/2cce81bc00446d0849c12f6f0742829eaae72138?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`8954da2`](https://app.codecov.io/gh/apache/incubator-seata-go/commit/8954da2ab82b47f5d197e7d39b737381c6b732de?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 2 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1083?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [pkg/datasource/sql/conn\_at.go](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1083?src=pr&el=tree&filepath=pkg%2Fdatasource%2Fsql%2Fconn_at.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2RhdGFzb3VyY2Uvc3FsL2Nvbm5fYXQuZ28=) | 50.00% | [3 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1083?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #1083 +/- ##
==========================================
+ Coverage 56.72% 57.00% +0.28%
==========================================
Files 267 266 -1
Lines 17574 17496 -78
==========================================
+ Hits 9968 9973 +5
+ Misses 6773 6690 -83
Partials 833 833
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1083?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org