From dcf2f0c42ed7d2f9ee06b217582a61af685c056b Mon Sep 17 00:00:00 2001 From: edwinhzhang Date: Thu, 28 Nov 2024 22:10:40 +0800 Subject: [PATCH] Optimization Logic Signed-off-by: edwinhzhang --- .../transaction/DatabaseTransactionMgr.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) 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 31b187d3fd597..da88943d3f5d2 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(); + } + } }