[Fix](variables) fix session variable does not take effect immediately when set global variable in follower FE#18609
Conversation
|
run buildall |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
| if (parsedStmt instanceof SetStmt) { | ||
| SetExecutor executor = new SetExecutor(ctx, (SetStmt) parsedStmt); | ||
| try { | ||
| executor.setSessionVars(); |
There was a problem hiding this 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().
There was a problem hiding this comment.
I think we can set remove the
globalproperty inSetStmtand than callexecutor.execute()method. No need to create a new methodsetSessionVars().
Ok, I see what you mean.
| } | ||
|
|
||
| private boolean isSessionVar(SetVar var) { | ||
| return !(var instanceof SetPassVar |
There was a problem hiding this 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;
There was a problem hiding this comment.
This is error-prone, if other people at a new subclass of
SetVar, this method may be missed. How about add aSetVarTypeor something to specify the stmt's type directly? And write likereturn var.setType() == Type.SET_SESSION_VAR;
Yes, I will modify it.
|
run buildall |
|
PR approved by at least one committer and no changes requested. |
…y when set global variable in follower FE (apache#18609)
…on master FE (#18949) Introduced from #18609. When setting global variables from Non Master FE, there will be error like: `Variable 'password_history' is a GLOBAL variable and should be set with SET GLOBAL` Because when setting global variables from Non Master FE, Doris will do following step: 1. forward this SetStmt to Master FE to execute. 2. Change this SetStmt to "SESSION" level, and execute it again on this Non Master FE. But for "GLOBAL only" variable, such ash "password_history", it doesn't allow to set on SESSION level. So when doing step 2, "set password_history=xxx" without "GLOBAL" keywords will throw exception. So in this case, we should just ignore this exception and return.
…on master FE (apache#18949) Introduced from apache#18609. When setting global variables from Non Master FE, there will be error like: `Variable 'password_history' is a GLOBAL variable and should be set with SET GLOBAL` Because when setting global variables from Non Master FE, Doris will do following step: 1. forward this SetStmt to Master FE to execute. 2. Change this SetStmt to "SESSION" level, and execute it again on this Non Master FE. But for "GLOBAL only" variable, such ash "password_history", it doesn't allow to set on SESSION level. So when doing step 2, "set password_history=xxx" without "GLOBAL" keywords will throw exception. So in this case, we should just ignore this exception and return.
…on master FE (apache#18949) Introduced from apache#18609. When setting global variables from Non Master FE, there will be error like: `Variable 'password_history' is a GLOBAL variable and should be set with SET GLOBAL` Because when setting global variables from Non Master FE, Doris will do following step: 1. forward this SetStmt to Master FE to execute. 2. Change this SetStmt to "SESSION" level, and execute it again on this Non Master FE. But for "GLOBAL only" variable, such ash "password_history", it doesn't allow to set on SESSION level. So when doing step 2, "set password_history=xxx" without "GLOBAL" keywords will throw exception. So in this case, we should just ignore this exception and return.
…on master FE (apache#18949) Introduced from apache#18609. When setting global variables from Non Master FE, there will be error like: `Variable 'password_history' is a GLOBAL variable and should be set with SET GLOBAL` Because when setting global variables from Non Master FE, Doris will do following step: 1. forward this SetStmt to Master FE to execute. 2. Change this SetStmt to "SESSION" level, and execute it again on this Non Master FE. But for "GLOBAL only" variable, such ash "password_history", it doesn't allow to set on SESSION level. So when doing step 2, "set password_history=xxx" without "GLOBAL" keywords will throw exception. So in this case, we should just ignore this exception and return.
…y when set global variable in follower FE (apache#18609)
…on master FE (apache#18949) Introduced from apache#18609. When setting global variables from Non Master FE, there will be error like: `Variable 'password_history' is a GLOBAL variable and should be set with SET GLOBAL` Because when setting global variables from Non Master FE, Doris will do following step: 1. forward this SetStmt to Master FE to execute. 2. Change this SetStmt to "SESSION" level, and execute it again on this Non Master FE. But for "GLOBAL only" variable, such ash "password_history", it doesn't allow to set on SESSION level. So when doing step 2, "set password_history=xxx" without "GLOBAL" keywords will throw exception. So in this case, we should just ignore this exception and return.
…on master FE (apache#18949) Introduced from apache#18609. When setting global variables from Non Master FE, there will be error like: `Variable 'password_history' is a GLOBAL variable and should be set with SET GLOBAL` Because when setting global variables from Non Master FE, Doris will do following step: 1. forward this SetStmt to Master FE to execute. 2. Change this SetStmt to "SESSION" level, and execute it again on this Non Master FE. But for "GLOBAL only" variable, such ash "password_history", it doesn't allow to set on SESSION level. So when doing step 2, "set password_history=xxx" without "GLOBAL" keywords will throw exception. So in this case, we should just ignore this exception and return.
…on master FE (apache#18949) Introduced from apache#18609. When setting global variables from Non Master FE, there will be error like: `Variable 'password_history' is a GLOBAL variable and should be set with SET GLOBAL` Because when setting global variables from Non Master FE, Doris will do following step: 1. forward this SetStmt to Master FE to execute. 2. Change this SetStmt to "SESSION" level, and execute it again on this Non Master FE. But for "GLOBAL only" variable, such ash "password_history", it doesn't allow to set on SESSION level. So when doing step 2, "set password_history=xxx" without "GLOBAL" keywords will throw exception. So in this case, we should just ignore this exception and return.
…on master FE (apache#18949) Introduced from apache#18609. When setting global variables from Non Master FE, there will be error like: `Variable 'password_history' is a GLOBAL variable and should be set with SET GLOBAL` Because when setting global variables from Non Master FE, Doris will do following step: 1. forward this SetStmt to Master FE to execute. 2. Change this SetStmt to "SESSION" level, and execute it again on this Non Master FE. But for "GLOBAL only" variable, such ash "password_history", it doesn't allow to set on SESSION level. So when doing step 2, "set password_history=xxx" without "GLOBAL" keywords will throw exception. So in this case, we should just ignore this exception and return.
…on master FE (apache#18949) Introduced from apache#18609. When setting global variables from Non Master FE, there will be error like: `Variable 'password_history' is a GLOBAL variable and should be set with SET GLOBAL` Because when setting global variables from Non Master FE, Doris will do following step: 1. forward this SetStmt to Master FE to execute. 2. Change this SetStmt to "SESSION" level, and execute it again on this Non Master FE. But for "GLOBAL only" variable, such ash "password_history", it doesn't allow to set on SESSION level. So when doing step 2, "set password_history=xxx" without "GLOBAL" keywords will throw exception. So in this case, we should just ignore this exception and return.
…on master FE (apache#18949) Introduced from apache#18609. When setting global variables from Non Master FE, there will be error like: `Variable 'password_history' is a GLOBAL variable and should be set with SET GLOBAL` Because when setting global variables from Non Master FE, Doris will do following step: 1. forward this SetStmt to Master FE to execute. 2. Change this SetStmt to "SESSION" level, and execute it again on this Non Master FE. But for "GLOBAL only" variable, such ash "password_history", it doesn't allow to set on SESSION level. So when doing step 2, "set password_history=xxx" without "GLOBAL" keywords will throw exception. So in this case, we should just ignore this exception and return.
…on master FE (apache#18949) Introduced from apache#18609. When setting global variables from Non Master FE, there will be error like: `Variable 'password_history' is a GLOBAL variable and should be set with SET GLOBAL` Because when setting global variables from Non Master FE, Doris will do following step: 1. forward this SetStmt to Master FE to execute. 2. Change this SetStmt to "SESSION" level, and execute it again on this Non Master FE. But for "GLOBAL only" variable, such ash "password_history", it doesn't allow to set on SESSION level. So when doing step 2, "set password_history=xxx" without "GLOBAL" keywords will throw exception. So in this case, we should just ignore this exception and return.
Proposed changes
Issue Number: close #xxx
Problem summary
For the non-master node, the
set global xxx = xxxwill not change the variables of the current session, because offorward()to master node execute.So the
set global xxx = xxxneeds to be executed again to change the current session afterforward().This PR will change behavior, but I think the old behavior is a bug.
Checklist(Required)
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...