JinyeongSeol commented on code in PR #8138:
URL: https://github.com/apache/incubator-seata/pull/8138#discussion_r3457075102
##########
integration-tx-api/src/main/java/org/apache/seata/integration/tx/api/fence/store/db/sql/CommonFenceStoreSqls.java:
##########
@@ -86,16 +88,14 @@ private CommonFenceStoreSqls() {
"delete from " + LOCAL_TCC_LOG_PLACEHOLD + " where xid = ? and
branch_id = ? ";
/**
- * The constant DELETE_BY_BRANCH_ID_AND_XID.
- */
- protected static final String DELETE_BY_BRANCH_XIDS =
- "delete from " + LOCAL_TCC_LOG_PLACEHOLD + " where xid in (" +
PRAMETER_PLACEHOLD + ")";
-
- /**
- * The constant DELETE_BY_DATE_AND_STATUS.
+ * The constant DELETE_BY_BRANCH_XIDS.
+ * The gmt_modified and status predicates must match {@link
#QUERY_END_STATUS_BY_DATE}: deleting by xid alone
+ * would also remove sibling branch rows of the same global transaction
that are still in a non-end status
+ * (e.g. TRIED) or not yet expired, which must be preserved.
*/
- protected static final String DELETE_BY_DATE_AND_STATUS = "delete from " +
LOCAL_TCC_LOG_PLACEHOLD
- + " where gmt_modified < ? "
+ protected static final String DELETE_BY_BRANCH_XIDS = "delete from " +
LOCAL_TCC_LOG_PLACEHOLD + " where xid in ("
+ + PRAMETER_PLACEHOLD + ")"
+ + " and gmt_modified < ? "
+ " and status in (" + CommonFenceConstant.STATUS_COMMITTED + " ,
" + CommonFenceConstant.STATUS_ROLLBACKED
+ " , " + CommonFenceConstant.STATUS_SUSPENDED + ")";
Review Comment:
DELETE_BY_BRANCH_XIDS is a pre-existing constant; this PR only extended its
predicate. Since it's an internal protected constant with no functional impact,
I'd prefer to keep the current name to keep the diff focused on the fix.
--
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]