Code-Fight commented on code in PR #875:
URL: 
https://github.com/apache/incubator-seata-go/pull/875#discussion_r2282770388


##########
pkg/datasource/sql/conn_xa.go:
##########
@@ -404,3 +415,17 @@ func (c *XAConn) XaRollback(ctx context.Context, xaXid 
XAXid) error {
        c.releaseIfNecessary()
        return err
 }
+
+// isXAER_RMFAILAlreadyEnded checks if the XAER_RMFAIL error indicates the XA 
branch is already ended
+func isXAER_RMFAILAlreadyEnded(err error) bool {
+       if err == nil {
+               return false
+       }
+
+       errMsg := err.Error()
+       // Check for XAER_RMFAIL error with "already ended" message
+       if strings.Contains(errMsg, "XAER_RMFAIL") && strings.Contains(errMsg, 
"already ended") {

Review Comment:
   The string matching approach in isXAER_RMFAILAlreadyEnded() is fragile
   Consider using error codes or types instead of string matching
   Different database vendors might format error messages differently
   



-- 
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-unsubscr...@seata.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to