This is an automated email from the ASF dual-hosted git repository.

zclll pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 588ed1e6c85 [fix](txn) Set transaction status to COMMITTED only after 
commit info is fully populated (#60749)
588ed1e6c85 is described below

commit 588ed1e6c85737f5b77de97b90a7b26eba354eb3
Author: zclllyybb <[email protected]>
AuthorDate: Sat Feb 14 14:57:16 2026 +0800

    [fix](txn) Set transaction status to COMMITTED only after commit info is 
fully populated (#60749)
    
    Related PR: https://github.com/apache/doris/pull/59990
    
    Problem Summary:
    
    Move setTransactionStatus(COMMITTED) to after idToTableCommitInfos
    population in both commitTransaction methods. This prevents
    PublishVersionDaemon from seeing COMMITTED status with empty commit
    info, as it checks status without synchronized(transactionState) lock.
---
 .../org/apache/doris/transaction/DatabaseTransactionMgr.java   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
 
b/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
index eb905f3eda1..b0a17790170 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
@@ -1589,7 +1589,6 @@ public class DatabaseTransactionMgr {
         if (MetricRepo.isInit) {
             MetricRepo.HISTO_TXN_EXEC_LATENCY.update(commitTime - 
transactionState.getPrepareTime());
         }
-        transactionState.setTransactionStatus(TransactionStatus.COMMITTED);
         transactionState.setErrorReplicas(errorReplicaIds);
         for (long tableId : tableToPartition.keySet()) {
             OlapTable table = (OlapTable) db.getTableNullable(tableId);
@@ -1601,6 +1600,10 @@ public class DatabaseTransactionMgr {
             }
             transactionState.putIdToTableCommitInfo(tableId, tableCommitInfo);
         }
+        // set COMMITTED only after idToTableCommitInfos is fully populated, 
so that
+        // PublishVersionDaemon (which checks status without 
synchronized(transactionState))
+        // will never see COMMITTED with empty commit info.
+        transactionState.setTransactionStatus(TransactionStatus.COMMITTED);
         // Update in-memory state only; caller handles edit log persistence
         unprotectUpdateInMemoryState(transactionState, false);
         transactionState.setInvolvedBackends(totalInvolvedBackends);
@@ -1619,7 +1622,6 @@ public class DatabaseTransactionMgr {
         if (MetricRepo.isInit) {
             MetricRepo.HISTO_TXN_EXEC_LATENCY.update(commitTime - 
transactionState.getPrepareTime());
         }
-        transactionState.setTransactionStatus(TransactionStatus.COMMITTED);
         transactionState.setErrorReplicas(errorReplicaIds);
 
         Map<Long, List<SubTransactionState>> tableToSubTransactionState = new 
HashMap<>();
@@ -1662,6 +1664,10 @@ public class DatabaseTransactionMgr {
                 transactionState.addSubTxnTableCommitInfo(subTransactionState, 
tableCommitInfo);
             }
         }
+        // set COMMITTED only after all commit info is fully populated, so that
+        // PublishVersionDaemon (which checks status without 
synchronized(transactionState))
+        // will never see COMMITTED with empty commit info.
+        transactionState.setTransactionStatus(TransactionStatus.COMMITTED);
         // Update in-memory state only; caller handles edit log persistence
         unprotectUpdateInMemoryState(transactionState, false);
         transactionState.setInvolvedBackends(totalInvolvedBackends);


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

Reply via email to