From 3735c21ef99bb901f2c6e725298b79ed3bc59c2b Mon Sep 17 00:00:00 2001 From: Mingyu Chen Date: Tue, 30 May 2023 16:26:28 +0800 Subject: [PATCH] [fix](session-variable) fix set global var on non-master FE return error (#20179) --- .../src/main/java/org/apache/doris/qe/VariableMgr.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java index 1d58c07f54..5408e74071 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java @@ -243,15 +243,18 @@ public class VariableMgr { } // Check if this setVar can be set correctly + // Do not use ErrorReport.reportDdlException to throw exeception, it will set the query state in connection context. + // But in some case, we do not want to set the query state and need to ignore that error. + // Set setVarForNonMasterFE() is an example. private static void checkUpdate(SetVar setVar, int flag) throws DdlException { if ((flag & READ_ONLY) != 0) { - ErrorReport.reportDdlException(ErrorCode.ERR_VARIABLE_IS_READONLY, setVar.getVariable()); + throw new DdlException(ErrorCode.ERR_VARIABLE_IS_READONLY.formatErrorMsg(setVar.getVariable())); } if (setVar.getType() == SetType.GLOBAL && (flag & SESSION_ONLY) != 0) { - ErrorReport.reportDdlException(ErrorCode.ERR_LOCAL_VARIABLE, setVar.getVariable()); + throw new DdlException(ErrorCode.ERR_GLOBAL_VARIABLE.formatErrorMsg(setVar.getVariable())); } if (setVar.getType() != SetType.GLOBAL && (flag & GLOBAL) != 0) { - ErrorReport.reportDdlException(ErrorCode.ERR_GLOBAL_VARIABLE, setVar.getVariable()); + throw new DdlException(ErrorCode.ERR_GLOBAL_VARIABLE.formatErrorMsg(setVar.getVariable())); } }