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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
