AlexStocks commented on code in PR #1052:
URL:
https://github.com/apache/incubator-seata-go/pull/1052#discussion_r2990515162
##########
pkg/datasource/sql/conn_xa.go:
##########
@@ -337,6 +392,12 @@ func (c *XAConn) rollbackErrorHandle() error {
}
func (c *XAConn) Commit(ctx context.Context) error {
+ // If this XA branch was created in autoCommit mode (multi-statement
transaction),
+ // don't do the actual XA commit here. The TC will handle it in Phase 2.
+ if c.txCtx.IsAutoCommitXABranch {
Review Comment:
[P0] 这里直接 `return nil` 会把 autoCommit XA 分支的 phase-1 完整短路掉。当前分支里
`RegisterXABranch/GetXABranch` 只负责复用连接,没有任何后续路径会再执行 `XA END + XA PREPARE` 或向 TC
上报 `PhaseOneDone/Failed`;`tm.GlobalTransactionManager.Commit`
也只发全局提交请求,不会回调到这个本地分支。结果就是这类分支既没有 prepare,也不会从 `xaConnsByXID`
清理,事务提交路径会丢失本地分支。建议把“复用同一 XA branch”与“结束/prepare branch”的时机拆开:复用期间不要重复
`BeginTx`,但在全局事务真正结束前仍然需要一个明确的 finalize 路径来执行 END/PREPARE/BranchReport。
--
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]