github-actions[bot] commented on code in PR #61881:
URL: https://github.com/apache/doris/pull/61881#discussion_r3070806535
##########
fe/fe-core/src/main/java/org/apache/doris/cloud/transaction/CloudGlobalTransactionMgr.java:
##########
@@ -1872,30 +1904,47 @@ private AbortTxnResponse abortTransactionImpl(Long
dbId, Long transactionId, Str
}
private void handleAfterAbort(AbortTxnResponse abortTxnResponse,
TxnCommitAttachment txnCommitAttachment,
- long transactionId) throws UserException {
+ long transactionId, long callbackId,
TxnStateChangeCallback cb) throws UserException {
TransactionState txnState = new TransactionState();
boolean txnOperated = false;
- long callbackId = 0L;
- TxnStateChangeCallback cb = null;
String abortReason = "";
if (abortTxnResponse != null) {
txnState =
TxnUtil.transactionStateFromPb(abortTxnResponse.getTxnInfo());
txnOperated = abortTxnResponse.getStatus().getCode() ==
MetaServiceCode.OK;
- callbackId = txnState.getCallbackId();
abortReason = txnState.getReason();
}
- if (txnCommitAttachment != null && txnCommitAttachment instanceof
RLTaskTxnCommitAttachment) {
- RLTaskTxnCommitAttachment rlTaskTxnCommitAttachment =
(RLTaskTxnCommitAttachment) txnCommitAttachment;
- callbackId = rlTaskTxnCommitAttachment.getJobId();
+ if (txnCommitAttachment instanceof RLTaskTxnCommitAttachment) {
txnState.setTransactionId(transactionId);
}
- cb = callbackFactory.getCallback(callbackId);
if (cb != null) {
LOG.info("run txn callback, txnId:{} callbackId:{}, txnState:{}",
transactionId, callbackId, txnState);
cb.afterAborted(txnState, txnOperated, abortReason);
Review Comment:
`abortTransaction()` now always reaches this `handleAfterAbort()` call from
the `finally`, so this branch runs `afterAborted(..., txnOperated=false)` even
when `abortTransactionImpl()` threw before the txn was actually aborted.
That is a behavior change from `DatabaseTransactionMgr.abortTransaction()`,
where `afterStateTransform(ABORTED, ...)` only runs after
`unprotectAbortTransaction()` succeeds. Some callbacks treat `afterAborted()`
as final cleanup regardless of `txnOperated` (for example
`DeleteJob.afterAborted()` removes the callback unconditionally), so a
transient meta-service/RPC failure here can drop the callback for a
still-`PREPARE` txn and break later retries or cleanup.
Please gate `afterAborted()` on a successful abort response, or otherwise
preserve the original "after callback only after real abort" contract.
--
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]