Skip to content

Commit

Permalink
sessionctx: set DefTiDBEnableRateLimitAction to false (pingcap#37811)
Browse files Browse the repository at this point in the history
  • Loading branch information
XuHuaiyu authored Sep 15, 2022
1 parent 6eab1bd commit 1d11283
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions executor/oomtest/oom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func TestMemTracker4DeleteExec(t *testing.T) {

oom.SetTracker("")

tk.Session().GetSessionVars().EnabledRateLimitAction = true
tk.Session().GetSessionVars().MemQuotaQuery = 10000
tk.MustExec("delete MemTracker4DeleteExec1, MemTracker4DeleteExec2 from MemTracker4DeleteExec1 join MemTracker4DeleteExec2 on MemTracker4DeleteExec1.a=MemTracker4DeleteExec2.a")
require.Equal(t, "memory exceeds quota, rateLimitAction delegate to fallback action", oom.GetTracker())
Expand Down
4 changes: 4 additions & 0 deletions session/session_test/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,7 @@ func TestCoprocessorOOMAction(t *testing.T) {
// Assert Coprocessor OOMAction
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("set @@tidb_enable_rate_limit_action=true")
tk.MustExec("create database testoom")
tk.MustExec("use testoom")
tk.MustExec(`set @@tidb_wait_split_region_finish=1`)
Expand Down Expand Up @@ -1763,6 +1764,7 @@ func TestCoprocessorOOMAction(t *testing.T) {
defer tk.MustExec("SET GLOBAL tidb_mem_oom_action = DEFAULT")
tk.MustExec("SET GLOBAL tidb_mem_oom_action='CANCEL'")
tk.MustExec("use testoom")
tk.MustExec("set @@tidb_enable_rate_limit_action=1")
tk.MustExec("set @@tidb_distsql_scan_concurrency = 10")
tk.MustExec(fmt.Sprintf("set @@tidb_mem_quota_query=%v;", quota))
var expect []string
Expand All @@ -1778,6 +1780,7 @@ func TestCoprocessorOOMAction(t *testing.T) {
t.Logf("disable OOM, testcase: %v", name)
quota := 5*copr.MockResponseSizeForTest - 100
tk.MustExec("use testoom")
tk.MustExec("set @@tidb_enable_rate_limit_action=0")
tk.MustExec("set @@tidb_distsql_scan_concurrency = 10")
tk.MustExec(fmt.Sprintf("set @@tidb_mem_quota_query=%v;", quota))
err := tk.QueryToErr(sql)
Expand Down Expand Up @@ -2093,6 +2096,7 @@ func TestSetEnableRateLimitAction(t *testing.T) {
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")

tk.MustExec("set @@tidb_enable_rate_limit_action=true")
// assert default value
result := tk.MustQuery("select @@tidb_enable_rate_limit_action;")
result.Check(testkit.Rows("1"))
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/tidb_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ const (
DefTiDBEnableParallelApply = false
DefTiDBEnableAmendPessimisticTxn = false
DefTiDBPartitionPruneMode = "dynamic"
DefTiDBEnableRateLimitAction = true
DefTiDBEnableRateLimitAction = false
DefTiDBEnableAsyncCommit = false
DefTiDBEnable1PC = false
DefTiDBGuaranteeLinearizability = true
Expand Down

0 comments on commit 1d11283

Please sign in to comment.