Skip to content

bug(frontend): SET GLOBAL long_query_time can return stale value in multi-CN #24837

Closed

Description

@XuPeng-SH

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

  1. added
    severity/s0
    on Jun 4, 2026
  2. added theissue type on Jun 4, 2026
  3. added this to the MO-202606 milestone on Jun 4, 2026
  4. added a commit that references this issue on Jun 5, 2026
    6cc32f1
  5. added a commit that references this issue on Jun 8, 2026
    6c82fd6
  6. added a commit that references this issue on Jun 8, 2026
    90efa65
  7. added 3 commits that reference this issue on Sep 17, 2026
    1a6d762
    3cc6b1a
    6054c1a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

severity/s0

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions