diff --git a/fe/fe-core/src/main/java/com/starrocks/transaction/DatabaseTransactionMgr.java b/fe/fe-core/src/main/java/com/starrocks/transaction/DatabaseTransactionMgr.java index 31b187d3fd5977..da88943d3f5d29 100644 --- a/fe/fe-core/src/main/java/com/starrocks/transaction/DatabaseTransactionMgr.java +++ b/fe/fe-core/src/main/java/com/starrocks/transaction/DatabaseTransactionMgr.java @@ -1207,13 +1207,7 @@ public void finishTransaction(long transactionId, Set errorReplicaIds) thr finishSpan.end(); } - writeLock(); - try { - transactionState.resetTabletCommitInfos(); - } finally { - writeUnlock(); - } - + resetTransactionStateTabletCommitInfos(transactionState); transactionState.notifyVisible(); // do after transaction finish GlobalStateMgr.getCurrentState().getOperationListenerBus().onStreamJobTransactionFinish(transactionState); @@ -1914,13 +1908,7 @@ public void finishTransactionNew(TransactionState transactionState, Set pu finishSpan.end(); } - writeLock(); - try { - transactionState.resetTabletCommitInfos(); - } finally { - writeUnlock(); - } - + resetTransactionStateTabletCommitInfos(transactionState); // do after transaction finish GlobalStateMgr.getCurrentState().getOperationListenerBus().onStreamJobTransactionFinish(transactionState); GlobalStateMgr.getCurrentState().getLocalMetastore().handleMVRepair(transactionState); @@ -2082,4 +2070,13 @@ public List getSamplesForMemoryTracker() { readUnlock(); } } + + public void resetTransactionStateTabletCommitInfos(TransactionState transactionState) { + writeLock(); + try { + transactionState.resetTabletCommitInfos(); + } finally { + writeUnlock(); + } + } }