From 3de3c6ff444306ccbae4746fe5bff6c76b19c151 Mon Sep 17 00:00:00 2001 From: meiyi Date: Mon, 23 Dec 2024 19:09:54 +0800 Subject: [PATCH] [fix](group commit) fix group commit session (#45800) if connect to observer, enable group commit and do insert overwrite, will get: ``` ERROR 1105 (HY000): errCode = 2, detailMessage = errCode = 2, detailMessage = Nereids does not support group commit insert ``` --- .../main/java/org/apache/doris/qe/SessionVariable.java | 2 +- .../src/main/java/org/apache/doris/qe/StmtExecutor.java | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java index 9a22c3d96e..e9dd9ec582 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java @@ -1785,7 +1785,7 @@ public class SessionVariable implements Serializable, Writable { @VariableMgr.VarAttr(name = LOAD_STREAM_PER_NODE) public int loadStreamPerNode = 2; - @VariableMgr.VarAttr(name = GROUP_COMMIT) + @VariableMgr.VarAttr(name = GROUP_COMMIT, needForward = true) public String groupCommit = "off_mode"; @VariableMgr.VarAttr(name = ENABLE_PREPARED_STMT_AUDIT_LOG, needForward = true) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java index a5ff53cb90..e490fa2b1c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java @@ -711,13 +711,6 @@ public class StmtExecutor { + Env.getCurrentEnv().getSelfNode().getHost() + ") and failed to execute" + " because Master FE is not ready. You may need to check FE's status")); } - if (context.getSessionVariable().isEnableInsertGroupCommit()) { - // FIXME: Group commit insert does not need to forward to master - // Nereids does not support group commit, so we can not judge if should forward - // Here throw an exception to fallback to legacy planner and let legacy judge if should forward - // After Nereids support group commit, we can remove this exception - throw new NereidsException(new UserException("Nereids does not support group commit insert")); - } forwardToMaster(); if (masterOpExecutor != null && masterOpExecutor.getQueryId() != null) { context.setQueryId(masterOpExecutor.getQueryId()); @@ -1354,6 +1347,8 @@ public class StmtExecutor { if (context.getSessionVariable().isEnableInsertGroupCommit() && parsedStmt instanceof NativeInsertStmt) { NativeInsertStmt nativeInsertStmt = (NativeInsertStmt) parsedStmt; nativeInsertStmt.analyzeGroupCommit(new Analyzer(context.getEnv(), context)); + redirectStatus = parsedStmt.getRedirectStatus(); + isForwardedToMaster = shouldForwardToMaster(); } redirectStatus = parsedStmt.getRedirectStatus(); }