You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "Cai-Yao (via GitHub)" <gi...@apache.org> on 2023/04/12 12:17:05 UTC

[GitHub] [doris] Cai-Yao opened a new pull request, #18609: [Fix](variables) fix session variable does not take effect immediately when set global variable in follower FE

Cai-Yao opened a new pull request, #18609:
URL: https://github.com/apache/doris/pull/18609

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   For the non-master node, the `set global xxx = xxx` will not change the variables of the current session, because of `forward()`  to master node execute.
   So the `set global xxx = xxx` needs to be executed again to change the current session after `forward()`.
   
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [ ] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto: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] [doris] Cai-Yao commented on a diff in pull request #18609: [Fix](variables) fix session variable does not take effect immediately when set global variable in follower FE

Posted by "Cai-Yao (via GitHub)" <gi...@apache.org>.
Cai-Yao commented on code in PR #18609:
URL: https://github.com/apache/doris/pull/18609#discussion_r1164980618


##########
fe/fe-core/src/main/java/org/apache/doris/qe/SetExecutor.java:
##########
@@ -59,9 +59,24 @@ private void setVariable(SetVar var) throws DdlException {
         }
     }
 
+    private boolean isSessionVar(SetVar var) {
+        return !(var instanceof SetPassVar

Review Comment:
   > This is error-prone, if other people at a new subclass of `SetVar`, this method may be missed. How about add a `SetVarType` or something to specify the stmt's type directly? And write like `return var.setType() == Type.SET_SESSION_VAR`;
   
   Yes, I will modify it.



-- 
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] [doris] morningman commented on a diff in pull request #18609: [Fix](variables) fix session variable does not take effect immediately when set global variable in follower FE

Posted by "morningman (via GitHub)" <gi...@apache.org>.
morningman commented on code in PR #18609:
URL: https://github.com/apache/doris/pull/18609#discussion_r1164976134


##########
fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java:
##########
@@ -163,6 +179,24 @@ private void forward() throws Exception {
         }
     }
 
+    // The SetStmt needs to be executed in follower again
+    // for the current session after master success
+    private void afterForwardExecute() throws DdlException {
+        if (parsedStmt != null) {
+            if (parsedStmt instanceof SetStmt) {
+                SetExecutor executor = new SetExecutor(ctx, (SetStmt) parsedStmt);
+                try {
+                    executor.setSessionVars();

Review Comment:
   I think we can set remove the `global` property in `SetStmt` and than call `executor.execute()` method. No need to create a new method `setSessionVars()`.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/SetExecutor.java:
##########
@@ -59,9 +59,24 @@ private void setVariable(SetVar var) throws DdlException {
         }
     }
 
+    private boolean isSessionVar(SetVar var) {
+        return !(var instanceof SetPassVar

Review Comment:
   This is error-prone, if other people at a new subclass of `SetVar`, this method may be missed.
   How about add a `SetVarType` or something to specify the stmt's type directly?
   And write like `return var.setType() == Type.SET_SESSION_VAR`;



-- 
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] [doris] yiguolei commented on pull request #18609: [Fix](variables) fix session variable does not take effect immediately when set global variable in follower FE

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on PR #18609:
URL: https://github.com/apache/doris/pull/18609#issuecomment-1506669999

   run buildall


-- 
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] [doris] github-actions[bot] commented on pull request #18609: [Fix](variables) fix session variable does not take effect immediately when set global variable in follower FE

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18609:
URL: https://github.com/apache/doris/pull/18609#issuecomment-1506296511

   PR approved by at least one committer and no changes requested.


-- 
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] [doris] github-actions[bot] commented on pull request #18609: [Fix](variables) fix session variable does not take effect immediately when set global variable in follower FE

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18609:
URL: https://github.com/apache/doris/pull/18609#issuecomment-1506674682

   PR approved by at least one committer and no changes requested.


-- 
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] [doris] github-actions[bot] commented on pull request #18609: [Fix](variables) fix session variable does not take effect immediately when set global variable in follower FE

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18609:
URL: https://github.com/apache/doris/pull/18609#issuecomment-1506296545

   PR approved by anyone and no changes requested.


-- 
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] [doris] Cai-Yao commented on a diff in pull request #18609: [Fix](variables) fix session variable does not take effect immediately when set global variable in follower FE

Posted by "Cai-Yao (via GitHub)" <gi...@apache.org>.
Cai-Yao commented on code in PR #18609:
URL: https://github.com/apache/doris/pull/18609#discussion_r1164984800


##########
fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java:
##########
@@ -163,6 +179,24 @@ private void forward() throws Exception {
         }
     }
 
+    // The SetStmt needs to be executed in follower again
+    // for the current session after master success
+    private void afterForwardExecute() throws DdlException {
+        if (parsedStmt != null) {
+            if (parsedStmt instanceof SetStmt) {
+                SetExecutor executor = new SetExecutor(ctx, (SetStmt) parsedStmt);
+                try {
+                    executor.setSessionVars();

Review Comment:
   > I think we can set remove the `global` property in `SetStmt` and than call `executor.execute()` method. No need to create a new method `setSessionVars()`.
   
   Ok, I see what you mean.



-- 
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] [doris] yiguolei merged pull request #18609: [Fix](variables) fix session variable does not take effect immediately when set global variable in follower FE

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei merged PR #18609:
URL: https://github.com/apache/doris/pull/18609


-- 
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] [doris] yiguolei commented on pull request #18609: [Fix](variables) fix session variable does not take effect immediately when set global variable in follower FE

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on PR #18609:
URL: https://github.com/apache/doris/pull/18609#issuecomment-1506296152

   run buildall


-- 
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