caiconghui commented on a change in pull request #5675:
URL: https://github.com/apache/incubator-doris/pull/5675#discussion_r617169766



##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
##########
@@ -1076,36 +1113,53 @@ private void clearBackendTransactions(TransactionState 
transactionState) {
     }
 
     public void removeExpiredTxns(long currentMillis) {
+        List<Long> expiredTxnIds = Lists.newArrayList();
+        // delete expired txns
         writeLock();
         try {
-            while (!finalStatusTransactionStateDeque.isEmpty()) {
-                TransactionState transactionState = 
finalStatusTransactionStateDeque.getFirst();
-                if (transactionState.isExpired(currentMillis)) {
-                    finalStatusTransactionStateDeque.pop();
-                    clearTransactionState(transactionState);
-                    editLog.logDeleteTransactionState(transactionState);
-                    LOG.info("transaction [" + 
transactionState.getTransactionId() + "] is expired, remove it from transaction 
manager");
-                } else {
-                    break;
-                }
+            unprotectedRemoveExpiredTxns(currentMillis, expiredTxnIds, 
finalStatusTransactionStateDequeShort);

Review comment:
        I suggest that we should do some experiments to make sure log 
BatchRemoveTransactionsOperation performance when there are many txns expired 
as the same time? I doubt that too many txns expired would cause bad 
performance when write log for bdbje?




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to