From 737e6290e63af6b9fcd7922c82150b44ff16b394 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Tue, 7 Dec 2021 19:58:36 -0700 Subject: [PATCH 1/2] sessionctx/variable: change tidb_store_limit to global only --- sessionctx/variable/sysvar.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index a1fcf7e025053..14fecee0a7b5c 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -1587,10 +1587,7 @@ var defaultSysVars = []*SysVar{ } return nil }}, - {Scope: ScopeGlobal | ScopeSession, Name: TiDBStoreLimit, Value: strconv.FormatInt(atomic.LoadInt64(&config.GetGlobalConfig().TiKVClient.StoreLimit), 10), Type: TypeInt, MinValue: 0, MaxValue: math.MaxInt64, SetSession: func(s *SessionVars, val string) error { - tikvstore.StoreLimit.Store(tidbOptInt64(val, DefTiDBStoreLimit)) - return nil - }, GetSession: func(s *SessionVars) (string, error) { + {Scope: ScopeGlobal, Name: TiDBStoreLimit, Value: strconv.FormatInt(atomic.LoadInt64(&config.GetGlobalConfig().TiKVClient.StoreLimit), 10), Type: TypeInt, MinValue: 0, MaxValue: math.MaxInt64, GetGlobal: func(s *SessionVars) (string, error) { return strconv.FormatInt(tikvstore.StoreLimit.Load(), 10), nil }, SetGlobal: func(s *SessionVars, val string) error { tikvstore.StoreLimit.Store(tidbOptInt64(val, DefTiDBStoreLimit)) From 81b0905b35ddec25e4f45a4ae921ea1628d26332 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Tue, 7 Dec 2021 21:19:30 -0700 Subject: [PATCH 2/2] fix broken test --- executor/set_test.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/executor/set_test.go b/executor/set_test.go index 2595b4a3131f5..425edf1c62ceb 100644 --- a/executor/set_test.go +++ b/executor/set_test.go @@ -366,16 +366,11 @@ func (s *testSerialSuite1) TestSetVar(c *C) { tk.MustExec("set @@tidb_expensive_query_time_threshold=70") tk.MustQuery("select @@tidb_expensive_query_time_threshold;").Check(testkit.Rows("70")) - tk.MustQuery("select @@tidb_store_limit;").Check(testkit.Rows("0")) - tk.MustExec("set @@tidb_store_limit = 100") - tk.MustQuery("select @@tidb_store_limit;").Check(testkit.Rows("100")) - tk.MustQuery("select @@session.tidb_store_limit;").Check(testkit.Rows("100")) tk.MustQuery("select @@global.tidb_store_limit;").Check(testkit.Rows("0")) - tk.MustExec("set @@tidb_store_limit = 0") - + tk.MustExec("set @@global.tidb_store_limit = 100") + tk.MustQuery("select @@global.tidb_store_limit;").Check(testkit.Rows("100")) + tk.MustExec("set @@global.tidb_store_limit = 0") tk.MustExec("set global tidb_store_limit = 100") - tk.MustQuery("select @@tidb_store_limit;").Check(testkit.Rows("100")) - tk.MustQuery("select @@session.tidb_store_limit;").Check(testkit.Rows("100")) tk.MustQuery("select @@global.tidb_store_limit;").Check(testkit.Rows("100")) tk.MustQuery("select @@session.tidb_metric_query_step;").Check(testkit.Rows("60"))