-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
type/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.
Description
Enhancement
Discovered in #28555
It looks like during bootstrap the value of ScopeNone
sysvars is persisted to mysql.global_variables
, but this is never consulted when the sysvar is read:
tidb/sessionctx/variable/varsutil.go
Lines 172 to 182 in d458059
// GetSessionOrGlobalSystemVar gets a system variable. | |
// If it is a session only variable, use the default value defined in code. | |
// Returns error if there is no such variable. | |
func GetSessionOrGlobalSystemVar(s *SessionVars, name string) (string, error) { | |
sv := GetSysVar(name) | |
if sv == nil { | |
return "", ErrUnknownSystemVar.GenWithStackByArgs(name) | |
} | |
if sv.HasNoneScope() { | |
return sv.Value, nil | |
} |
If the intention is to persist, the var should be instead be changed to global Scope + set as read only instead.
Most of the ScopeNone sysvars are instance scoped (not global) and overwritten during server startup. So this is not causing any current bugs, it just looks confusing when inspecting the table.
Metadata
Metadata
Assignees
Labels
type/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.