diff --git a/session/bootstrap.go b/session/bootstrap.go index 2244e3eaa5484..e5c588ec5af01 100644 --- a/session/bootstrap.go +++ b/session/bootstrap.go @@ -1764,8 +1764,8 @@ func doDMLWorks(s Session) { // Init global system variables table. values := make([]string, 0, len(variable.GetSysVars())) for k, v := range variable.GetSysVars() { - // Session only variable should not be inserted. - if v.Scope != variable.ScopeSession { + // Only global variables should be inserted. + if v.HasGlobalScope() { vVal := v.Value if v.Name == variable.TiDBTxnMode && config.GetGlobalConfig().Store == "tikv" { vVal = "pessimistic" diff --git a/session/bootstrap_serial_test.go b/session/bootstrap_serial_test.go index 1de04a5ca91f3..6caf7e702c10b 100644 --- a/session/bootstrap_serial_test.go +++ b/session/bootstrap_serial_test.go @@ -113,7 +113,7 @@ func TestBootstrap(t *testing.T) { func globalVarsCount() int64 { var count int64 for _, v := range variable.GetSysVars() { - if v.Scope != variable.ScopeSession { + if v.HasGlobalScope() { count++ } }