Repository navigation
Description
Summary
In the multi-CN BVT job for PR #24692, SET GLOBAL long_query_time = 1.1 was followed by SHOW GLOBAL VARIABLES LIKE long_query_time, but the readback returned the default value 10 instead of 1.1.\n\nThis looks like a global system variable visibility/cache problem across CNs or sessions, not an issue in the PR itself.\n\n## CI evidence\n\nWorkflow job: https://github.com/matrixorigin/matrixone/actions/runs/26873545996/job/79254937464?pr=24692\n\nFailed case from artifact report/error.txt:\n\n- File: test/distributed/cases/system_variable/system_variables.sql\n- Row: 215\n- Statement: show global variables like long_query_time;\n- Expected: 1.1\n- Actual: 10\n\nRelevant SQL around the failure:\n\nsql\nset global long_query_time = 1.1;\nshow global variables like long_query_time;\nset global long_query_time = default;\nshow global variables like long_query_time;\n\n\n## Why this looks like a multi-CN/global-cache bug\n\nFrom the current frontend code path:\n\n1. SHOW GLOBAL VARIABLES reads from the sessions cached global sysvars via doShowVariables -> ses.GetGlobalSysVar(...)\n - pkg/frontend/mysql_cmd_executor.go:1067-1071\n - pkg/frontend/types.go:1313-1325\n2. SET GLOBAL persists the value and updates only the current sessions ses.gSysVars\n - pkg/frontend/types.go:1328-1377\n - pkg/frontend/authenticate.go:10279-10311\n3. Session initialization reloads globals from the system table once and then clones them into the session\n - pkg/frontend/session.go:275-283\n - pkg/frontend/session.go:1680-1719\n4. I did not find a cross-CN invalidation/broadcast path for ordinary global sysvars after SET GLOBAL\n\nThat means in a multi-CN environment, if the follow-up SHOW GLOBAL is served by another existing session/CN whose gSysVars cache has not been refreshed, it can still see the old/default value.\n\n## Impact\n\nSET GLOBAL for ScopeBoth/ScopeGlobal variables may not become immediately visible across CNs or across already-initialized sessions, which makes SHOW GLOBAL VARIABLES inconsistent in multi-CN deployments.\n\n## Suggested investigation\n\n- Verify whether existing sessions on other CNs refresh gSysVars after SET GLOBAL\n- Decide whether SET GLOBAL should broadcast/invalidate global sysvar caches across CNs\n- Add a multi-CN regression test for SET GLOBAL ...; SHOW GLOBAL VARIABLES LIKE ...; on a dynamic global variable such as long_query_time
Activity
fix(frontend): refresh global sysvars for SHOW GLOBAL VARIABLES (#24844)
fix(frontend): refresh global sysvars for SHOW GLOBAL VARIABLES (#24838)
fix(frontend): refresh global sysvars for SHOW GLOBAL VARIABLES (matr…
fix(frontend): refresh global sysvars for SHOW GLOBAL VARIABLES (matr…
fix(frontend): refresh global sysvars for SHOW GLOBAL VARIABLES (matr…
fix(frontend): refresh global sysvars for SHOW GLOBAL VARIABLES (matr…