mymeiyi commented on code in PR #32980:
URL: https://github.com/apache/doris/pull/32980#discussion_r1590486660


##########
fe/fe-core/src/main/java/org/apache/doris/transaction/TransactionEntry.java:
##########
@@ -261,22 +278,62 @@ public long abortTransaction()
         }
     }
 
+    private void beforeFinishTransaction() {
+        if (isTransactionBegan) {
+            List<Long> tableIds = 
transactionState.getTableIdList().stream().distinct().collect(Collectors.toList());
+            transactionState.setTableIdList(tableIds);
+            subTransactionStates.sort((s1, s2) -> {
+                if (s1.getSubTransactionType() == SubTransactionType.INSERT

Review Comment:
   1. We provide that, each statement cannot read the modifications made by 
other statements within the same transaction.
   2. For delete command, there are 2 implementations,  one is delete 
condition, one is insert. 
   3. If the delete condition is committed after the insert, the delete will 
work for the insert, for example:
   ```
   begin;
   insert into t select * from t1 where id = 1;
   delete from t where id = 1;
   commit;
   ```
   4. So we make the delete condition commit before the insert.
   



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