github-actions[bot] commented on code in PR #61881:
URL: https://github.com/apache/doris/pull/61881#discussion_r3071526957
##########
fe/fe-core/src/main/java/org/apache/doris/cloud/transaction/CloudGlobalTransactionMgr.java:
##########
@@ -1803,29 +1804,60 @@ public void abortTransaction(Long dbId, Long
transactionId, String reason) throw
@Override
public void abortTransaction(Long dbId, Long transactionId, String reason,
TxnCommitAttachment txnCommitAttachment, List<Table> tableList)
throws UserException {
- if (txnCommitAttachment != null) {
- if (txnCommitAttachment instanceof RLTaskTxnCommitAttachment) {
- RLTaskTxnCommitAttachment rlTaskTxnCommitAttachment =
(RLTaskTxnCommitAttachment) txnCommitAttachment;
- TxnStateChangeCallback cb =
callbackFactory.getCallback(rlTaskTxnCommitAttachment.getJobId());
- if (cb != null) {
- // use a temporary transaction state to do before commit
check,
- // what actually works is the transactionId
- TransactionState tmpTxnState = new TransactionState();
- tmpTxnState.setTransactionId(transactionId);
- cb.beforeAborted(tmpTxnState);
- }
- }
- }
+ Pair<Long, TxnStateChangeCallback> callbackInfo =
+ handleBeforeAbort(dbId, transactionId, txnCommitAttachment);
AbortTxnResponse abortTxnResponse = null;
try {
abortTxnResponse = abortTransactionImpl(dbId, transactionId,
reason, null);
} finally {
- handleAfterAbort(abortTxnResponse, txnCommitAttachment,
transactionId);
+ handleAfterAbort(abortTxnResponse, txnCommitAttachment,
transactionId,
+ callbackInfo.first, callbackInfo.second);
clearTxnLastSignature(dbId, transactionId);
}
}
+ /**
Review Comment:
If this extra `getTransactionState()` call fails transiently (RPC error /
null response / non-OK status), `callbackId` stays `0` and we never invoke
`afterAborted()` even if the subsequent `abortTransactionImpl()` succeeds. That
means the original routine-load cleanup path is still broken in exactly that
scenario: the txn becomes ABORTED in meta-service, but the RL job never renews
the task because the callback was skipped.
Concretely, `abortTxnWhenCoordinateBeRestart()` iterates PREPARE txns from
meta-service, so the abort RPC can still succeed for this txn right after this
pre-query returns `null`. In that case `handleAfterAbort()` receives `cb ==
null` and drops the callback entirely.
I think this needs a fallback based on the successful `abortTxnResponse`
(for example, recover `callbackId` from `txnState` when `callbackInfo.second ==
null` because the pre-query failed, or avoid changing behavior when the
pre-query cannot confirm the callback).
--
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]