[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 ```
This commit is contained in:
@ -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)
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user