You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/12/29 05:43:48 UTC

[GitHub] [incubator-doris] morningman opened a new pull request #7526: [fix](session-variable) fix bug that checkpoint may overwrite the global variables

morningman opened a new pull request #7526:
URL: https://github.com/apache/incubator-doris/pull/7526


   ## Proposed changes
   
   Close related #7525 (replace it with issue number if it exists).
   
   We should create temporary object for some static fields when doing checkpoint,
   to avoid these variables to be overwritten by the checkpoint process.
   
   ## Types of changes
   
   What types of changes does your code introduce to Doris?
   _Put an `x` in the boxes that apply_
   
   - [x] Bugfix (non-breaking change which fixes an issue)
   
   ## Checklist
   
   _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
   
   - [ ] I have created an issue on (Fix #ISSUE) and described the bug/feature there in detail
   - [ ] Compiling and unit tests pass locally with my changes
   - [ ] I have added tests that prove my fix is effective or that my feature works
   - [ ] If these changes need document changes, I have updated the document
   - [ ] Any dependent changes have been merged
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...
   


-- 
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-unsubscribe@doris.apache.org

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



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


[GitHub] [incubator-doris] morningman commented on a change in pull request #7526: [fix](session-variable) fix bug that checkpoint may overwrite the global variables

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #7526:
URL: https://github.com/apache/incubator-doris/pull/7526#discussion_r783711765



##########
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:
       No, the `read` method will be called:
   1. when FE start
   2. checkpoint thread




-- 
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-unsubscribe@doris.apache.org

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



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


[GitHub] [incubator-doris] morningman commented on a change in pull request #7526: [fix](session-variable) fix bug that checkpoint may overwrite the global variables

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #7526:
URL: https://github.com/apache/incubator-doris/pull/7526#discussion_r783710156



##########
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:
       Not exactly, the `write` method may be called in:
   1. Checkpoint thread
   2. when calling `/dump` http api
   




-- 
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-unsubscribe@doris.apache.org

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



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


[GitHub] [incubator-doris] morningman merged pull request #7526: [fix](session-variable) fix bug that checkpoint may overwrite the global variables

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #7526:
URL: https://github.com/apache/incubator-doris/pull/7526


   


-- 
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-unsubscribe@doris.apache.org

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



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


[GitHub] [incubator-doris] xy720 commented on a change in pull request #7526: [fix](session-variable) fix bug that checkpoint may overwrite the global variables

Posted by GitBox <gi...@apache.org>.
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-unsubscribe@doris.apache.org

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



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