yiguolei commented on a change in pull request #8423:
URL: https://github.com/apache/incubator-doris/pull/8423#discussion_r824341848



##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
##########
@@ -793,22 +794,20 @@ public void finishTransaction(long transactionId, 
Set<Long> errorReplicaIds) thr
             errorReplicaIds.addAll(originalErrorReplicas);
         }
 
-        Database db = catalog.getDbNullable(transactionState.getDbId());
-        if (db == null) {
-            writeLock();
-            try {
-                
transactionState.setTransactionStatus(TransactionStatus.ABORTED);
-                transactionState.setReason("db is dropped");
-                LOG.warn("db is dropped during transaction, abort transaction 
{}", transactionState);
-                unprotectUpsertTransactionState(transactionState, false);
-                return;
-            } finally {
-                writeUnlock();
-            }
-        }
+        // case 1 If database is dropped, then we just throw 
MetaNotFoundException, because all related tables are already force dropped,
+        // it is safe to abort the transaction with all tables been force 
dropped.
+        // case 2 If at least one table lock successfully, which means that 
the transaction should be finished for the existed tables
+        // while just ignore tables which have been dropped forcefully.
+        // case 3 Database exist and all tables already been dropped, this 
case is same with case1, just abort the transaction
+        // only three cases mentioned above may happen, because user cannot 
drop table without force while there are committed transactions on table
+        // and writeLockTablesIfExist is a blocking function, the returned 
result would be the existed table list which hold write lock
+        Database db = catalog.getDbOrMetaException(transactionState.getDbId());

Review comment:
       If database is recycled or dropped, db related txn manager will be 
removed. But when the db is restored from recycle bin,  some txns is lost, how 
to deal with this case?




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

To unsubscribe, e-mail: [email protected]

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