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



##########
File path: 
fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
##########
@@ -500,8 +485,15 @@ public boolean commitAndPublishTransaction(Database db, 
long transactionId,
         } finally {
             db.writeUnlock();
         }
-        
-        TransactionState transactionState = 
idToTransactionState.get(transactionId);
+        DatabaseTransactionMgr dbTransactionMgr = 
getDatabaseTransactioMgr(db.getId());
+        TransactionState transactionState = null;
+        dbTransactionMgr.readLock();

Review comment:
       it is only exposed to GlobalTransactionMgr, we still use 
GlobalTransactionMgr to do some txn management work in global view, 
DatabaeTransactionMgr cannot be an independent existence without 
GlobalTransactionMgr. it is normal for  GlobalTransactionMgr to invoke some 
DatabaeTransactionMgr's methods and ensure they are 'atomatic' by lock, while 
DatabaseTransactionMgr only need to provide some basic methods about txn. If we 
not expose dbTransactionMgr's lock to GlobalTransactionMgr, the work for 
DatabaeTransactionMgr is too heavy.




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