xy720 commented on a change in pull request #7526:
URL: https://github.com/apache/incubator-doris/pull/7526#discussion_r776290428



##########
File path: fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
##########
@@ -304,17 +286,30 @@ public static void setLowerCaseTableNames(int mode) 
throws DdlException {
 
     // global variable persistence
     public static void write(DataOutputStream out) throws IOException {
-        defaultSessionVariable.write(out);
+        SessionVariable variablesToWrite = defaultSessionVariable;
+        if (Catalog.isCheckpointThread()) {

Review comment:
       There should not be non-checkpoint-thread calling this method. Why not 
directly use defaultSessionVariableForCkpt instead.

##########
File path: fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
##########
@@ -304,17 +286,30 @@ public static void setLowerCaseTableNames(int mode) 
throws DdlException {
 
     // global variable persistence
     public static void write(DataOutputStream out) throws IOException {
-        defaultSessionVariable.write(out);
+        SessionVariable variablesToWrite = defaultSessionVariable;
+        if (Catalog.isCheckpointThread()) {
+            // If this is checkpoint thread, we should write value in 
`defaultSessionVariableForCkpt` to the image
+            // instead of `defaultSessionVariable`.
+            variablesToWrite = defaultSessionVariableForCkpt;
+        }
+        variablesToWrite.write(out);
         // get all global variables
         List<String> varNames = GlobalVariable.getPersistentGlobalVarNames();
-        GlobalVarPersistInfo info = new 
GlobalVarPersistInfo(defaultSessionVariable, varNames);
+        GlobalVarPersistInfo info = new GlobalVarPersistInfo(variablesToWrite, 
varNames);
         info.write(out);
     }
 
     public static void read(DataInputStream in) throws IOException, 
DdlException {
         wlock.lock();
         try {
-            defaultSessionVariable.readFields(in);
+            SessionVariable variablesToRead = defaultSessionVariable;
+            if (Catalog.isCheckpointThread()) {

Review comment:
       The same as above




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to