Repository navigation
fix(frontend): refresh global sysvars for SHOW GLOBAL VARIABLES - #24838
mergify[bot] merged 3 commits into
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Blocking:
doShowVariables now refreshes globals by calling Session.InitSystemVariables, but that helper does more than refresh gSysVars: it also resets ses.sesSysVars = ses.gSysVars.Clone() and recomputes rewriteEnabled (pkg/frontend/session.go:275-289). So a read-only statement like SHOW GLOBAL VARIABLES will now silently discard session-level overrides such as SET SESSION interactive_timeout = ..., and can also flip cached session behavior like enable_remap_hint.
That makes the fix behavior-changing for the current session. Please refresh only the global snapshot used by GetGlobalSysVar, or otherwise preserve the existing session-scoped variables/cache. A focused regression test for keeping session overrides intact after SHOW GLOBAL VARIABLES would also help.
baed3b2 to
0b644f4
Compare
|
Addressed the blocking review. Changes:
Tests:
|
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed from three angles:
- correctness: the earlier session-state regression is fixed by refreshing only global sysvars
- performance: the extra refresh cost is limited to SHOW GLOBAL VARIABLES and is acceptable for this path
- tests: the new regression test now also protects session overrides and rewriteEnabled state
Looks good to merge.
34db397 to
4ec42fb
Compare
Merge Queue Status
This pull request spent 26 minutes 45 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonThe merge conditions cannot be satisfied due to failing checks HintYou may have to fix your CI before adding the pull request to the queue again. |
Merge Queue Status
This pull request spent 30 seconds in the queue, including 3 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) does this PR fix or relate to?
#24837
What this PR does / why we need it:
SHOW GLOBAL VARIABLESlong_query_timecached in the current CN/sessionFixes #24837
Tests
TestShowGlobalVariablesRefreshesGlobalSysVarCachefailed with actual10instead of expected1.1CGO_CFLAGS="-I$(pwd)/cgo -I$(pwd)/thirdparties/install/include" CGO_LDFLAGS="-L$(pwd)/cgo -lmo -L$(pwd)/thirdparties/install/lib -Wl,-rpath,$(pwd)/lib -fopenmp" GOFLAGS=-mod=mod go test ./pkg/frontend -run TestShowGlobalVariablesRefreshesGlobalSysVarCache -count=1CGO_CFLAGS="-I$(pwd)/cgo -I$(pwd)/thirdparties/install/include" CGO_LDFLAGS="-L$(pwd)/cgo -lmo -L$(pwd)/thirdparties/install/lib -Wl,-rpath,$(pwd)/lib -fopenmp" GOFLAGS=-mod=mod go test ./pkg/frontend -run 'Test_handleShowVariables|TestShowGlobalVariablesRefreshesGlobalSysVarCache' -count=1