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

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit d6af2e5af599b61125c2b307c7f3cd1d3ddb4a0c
Author: meiyi <myime...@gmail.com>
AuthorDate: Thu Jun 13 22:05:23 2024 +0800

    [fix](group commit) Fix group commit in nereids (#36267)
    
    ## Proposed changes
    
    1. The group commit in nereids use `isGroupCommit` variable in
    `ConnectContext` to mark if it is a group commit, but not reset. If
    executes 2 sqls, the first is group_commit, the second is not
    group_commit, the `isGroupCommit` is true for the second sql and the
    data_sink is `GroupCommitBlockSink`
    2. Move the `isGroupCommitAvailablePlan` to the end when check
    `canGroupCommit` because it's cpu expensive
---
 .../trees/plans/commands/insert/GroupCommitInsertExecutor.java   | 9 +++++----
 .../src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java | 1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/GroupCommitInsertExecutor.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/GroupCommitInsertExecutor.java
index 19b3ba1ff90..f4d640e2c64 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/GroupCommitInsertExecutor.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/GroupCommitInsertExecutor.java
@@ -95,10 +95,11 @@ public class GroupCommitInsertExecutor extends 
AbstractInsertExecutor {
         }
         OlapTable targetTable = physicalOlapTableSink.getTargetTable();
         return ctx.getSessionVariable().getSqlMode() != 
SqlModeHelper.MODE_NO_BACKSLASH_ESCAPES
-                && !ctx.isTxnModel() && 
isGroupCommitAvailablePlan(physicalOlapTableSink, planner)
-                && physicalOlapTableSink.getPartitionIds().isEmpty() && 
targetTable.getTableProperty()
-                .getUseSchemaLightChange() && !targetTable.getQualifiedDbName()
-                .equalsIgnoreCase(FeConstants.INTERNAL_DB_NAME);
+                && !ctx.isTxnModel()
+                && physicalOlapTableSink.getPartitionIds().isEmpty()
+                && targetTable.getTableProperty().getUseSchemaLightChange()
+                && 
!targetTable.getQualifiedDbName().equalsIgnoreCase(FeConstants.INTERNAL_DB_NAME)
+                && isGroupCommitAvailablePlan(physicalOlapTableSink, planner);
     }
 
     private static boolean literalExpr(NereidsPlanner planner) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java
index 6c1507722d7..5480e964f28 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java
@@ -315,6 +315,7 @@ public class MysqlConnectProcessor extends ConnectProcessor 
{
     public void processOnce() throws IOException {
         // set status of query to OK.
         ctx.getState().reset();
+        ctx.setGroupCommit(false);
         executor = null;
 
         // reset sequence id of MySQL protocol


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to