Similarityoung commented on code in PR #745:
URL: 
https://github.com/apache/incubator-seata-go/pull/745#discussion_r1967169637


##########
pkg/rm/tcc/fence/store/db/sql/tcc_fence_store_sql.go:
##########
@@ -28,20 +28,32 @@ var (
        // localTccLogPlaced The enum LocalTccLogPlaced
        localTccLogPlaced = " %s "
 
+       pramPlaceHolder = "%s "
+
        // insertLocalTccLog The enum InsertLocalTccLog
        insertLocalTccLog = "insert into " + localTccLogPlaced + " (xid, 
branch_id, action_name, status, gmt_create, gmt_modified) values ( ?,?,?,?,?,?)"
 
        // queryByBranchIdAndXid The enum QueryByBranchIdAndXid
        queryByBranchIdAndXid = "select xid, branch_id, action_name, status, 
gmt_create, gmt_modified from " + localTccLogPlaced + " where xid = ? and 
branch_id = ? for update"
 
+       // queryByMdDate The enum QueryByMdDate
+       queryByMdDate = "select xid, branch_id from " + localTccLogPlaced + " 
where gmt_modified < ? " +
+               " and status in (" + strconv.Itoa(int(enum.StatusCommitted)) + 
" , " + strconv.Itoa(int(enum.StatusRollbacked)) + " , " + 
strconv.Itoa(int(enum.StatusSuspended)) + ")"
+
        // updateStatusByBranchIdAndXid The enum UpdateStatusByBranchIdAndXid
        updateStatusByBranchIdAndXid = "update " + localTccLogPlaced + " set 
status = ?, gmt_modified = ? where xid = ? and  branch_id = ? and status = ? "
 
        // deleteByBranchIdAndXid The enum DeleteByBranchIdAndXid
        deleteByBranchIdAndXid = "delete from " + localTccLogPlaced + " where 
xid = ? and  branch_id = ? "
 
+       // deleteByBranchIdsAndXids The enum DeleteByBranchIdsAndXids
+       deleteByBranchIdsAndXids = "delete from " + localTccLogPlaced + " where 
(xid,branch_id) in (" + pramPlaceHolder + ")"

Review Comment:
   因为我看之前有删除的 sql 语句就是根据 xid 和 branchid 进行删除的。并且之前PrepareFence 
方法中,insertTCCFenceLog 失败后也会把他的 xid 和 branchid放入channel 中用于执行删除语句,所以我是根据 xid 和 
branchid 来删除的。



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