Skip to content

Commit

Permalink
[fix](group commit) fix group commit session (#45800)
Browse files Browse the repository at this point in the history

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
```
  • Loading branch information
mymeiyi authored Dec 23, 2024
1 parent 901b932 commit 3de3c6f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,7 @@ public void setEnableLeftZigZag(boolean enableLeftZigZag) {
@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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -711,13 +711,6 @@ private void executeByNereids(TUniqueId queryId) throws Exception {
+ 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());
Expand Down Expand Up @@ -1354,6 +1347,8 @@ private void parseByLegacy() throws AnalysisException, DdlException {
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();
}
Expand Down

0 comments on commit 3de3c6f

Please sign in to comment.