CAICAIIs commented on code in PR #1119:
URL: 
https://github.com/apache/incubator-seata-go/pull/1119#discussion_r3487263346


##########
pkg/datasource/sql/xa/oracle_xa_connection.go:
##########
@@ -20,92 +20,325 @@ package xa
 import (
        "context"
        "database/sql/driver"
+       "encoding/hex"
+       "errors"
        "fmt"
+       "io"
+       "strconv"
+       "strings"
        "time"
 
        "seata.apache.org/seata-go/v2/pkg/datasource/sql/types"
-       "seata.apache.org/seata-go/v2/pkg/util/log"
 )
 
+const (
+       oracleXAMaxXIDPartSize = 64
+       oracleXAFormatID       = 0x53474F
+       oracleXAOK             = 0
+)
+
+var _ XAResource = (*OracleXAConn)(nil)
+
 func init() {
        RegisterXAResourceFactory(types.DBTypeOracle, 
&oracleXAResourceFactory{})
 }
 
 type oracleXAResourceFactory struct{}
 
 func (f *oracleXAResourceFactory) CreateXAResource(conn driver.Conn) 
XAResource {
-       return &OracleXAConn{Conn: conn}
+       return NewOracleXaConn(conn)
 }
 
 func (f *oracleXAResourceFactory) CreateErrorClassifier() XAErrorClassifier {
        return &OracleXAErrorClassifier{}
 }
 
-// OracleXAErrorClassifier classifies Oracle-specific XA errors.
+// OracleXAErrorClassifier recognizes Oracle errors that indicate an XA branch 
has already ended.
 type OracleXAErrorClassifier struct{}
 
 func (c *OracleXAErrorClassifier) IsAlreadyEnded(err error) bool {
-       // TODO: check ORA-24756 (transaction does not exist) / ORA-24761 
(rolled back)
-       return false
+       return oracleXAHasErrorCode(err, "24756") || oracleXAHasErrorCode(err, 
"24761")
+}
+
+func (c *OracleXAErrorClassifier) IsAlreadyCommitted(err error) bool {

Review Comment:
   Good point. I changed OracleXAErrorClassifier so ORA-24756 is no longer 
treated as already committed. Commit idempotency now depends on the local 
committed cache or a more explicit committed signal, not just “transaction does 
not exist”.



-- 
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]

Reply via email to