diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java index 027d346d0bf571..91a45bb71b07fc 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java @@ -2645,7 +2645,7 @@ public long saveGlobalVariable(CountingDataOutputStream dos, long checksum) thro } public void replayGlobalVariableV2(GlobalVarPersistInfo info) throws IOException, DdlException { - VariableMgr.replayGlobalVariableV2(info); + VariableMgr.replayGlobalVariableV2(info, false); } public long saveLoadJobsV2(CountingDataOutputStream dos, long checksum) throws IOException { 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 93f931fff124aa..1305b2944abae9 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 @@ -459,21 +459,21 @@ public static void read(DataInputStream in) throws IOException, DdlException { } variablesToRead.readFields(in); GlobalVarPersistInfo info = GlobalVarPersistInfo.read(in); - replayGlobalVariableV2(info); + replayGlobalVariableV2(info, true); } finally { wlock.unlock(); } } // this method is used to replace the `replayGlobalVariable()` - public static void replayGlobalVariableV2(GlobalVarPersistInfo info) throws DdlException { + public static void replayGlobalVariableV2(GlobalVarPersistInfo info, boolean fromImage) throws DdlException { wlock.lock(); try { String json = info.getPersistJsonString(); JSONObject root = (JSONObject) JSONValue.parse(json); // if not variable version, we set it to 0 to ensure we could force set global variable. boolean hasVariableVersion = root.containsKey(GlobalVariable.VARIABLE_VERSION); - if (!hasVariableVersion) { + if (fromImage && !hasVariableVersion) { GlobalVariable.variableVersion = GlobalVariable.VARIABLE_VERSION_0; } for (Object varName : root.keySet()) {