@@ -26,6 +26,19 @@ import (
26
26
"github.com/stretchr/testify/require"
27
27
)
28
28
29
+ func TestInstancePlanCacheMinSize (t * testing.T ) {
30
+ store := testkit .CreateMockStore (t )
31
+ tk := testkit .NewTestKit (t , store )
32
+ tk .MustExecToErr ("set global tidb_instance_plan_cache_max_size=0" )
33
+ tk .MustExecToErr ("set global tidb_instance_plan_cache_max_size=1" )
34
+ tk .MustExecToErr ("set global tidb_instance_plan_cache_max_size=101KiB" )
35
+ tk .MustExecToErr ("set global tidb_instance_plan_cache_max_size=10001KiB" )
36
+ tk .MustExecToErr ("set global tidb_instance_plan_cache_max_size=99MiB" )
37
+ tk .MustExec ("set global tidb_instance_plan_cache_max_size=100MiB" )
38
+ tk .MustExec ("set global tidb_instance_plan_cache_max_size=101MiB" )
39
+ tk .MustExec ("set global tidb_instance_plan_cache_max_size=2000000KiB" )
40
+ }
41
+
29
42
func TestInstancePlanCacheVars (t * testing.T ) {
30
43
store := testkit .CreateMockStore (t )
31
44
tk := testkit .NewTestKit (t , store )
@@ -45,8 +58,8 @@ func TestInstancePlanCacheVars(t *testing.T) {
45
58
tk .MustExecToErr (`set global tidb_instance_plan_cache_max_size=-1` )
46
59
tk .MustExecToErr (`set global tidb_instance_plan_cache_max_size=-1111111111111` )
47
60
tk .MustExecToErr (`set global tidb_instance_plan_cache_max_size=dslfj` )
48
- tk .MustExec (`set global tidb_instance_plan_cache_max_size=123456 ` )
49
- tk .MustQuery (`select @@tidb_instance_plan_cache_max_size` ).Check (testkit .Rows ("123456 " ))
61
+ tk .MustExec (`set global tidb_instance_plan_cache_max_size=1234560000 ` )
62
+ tk .MustQuery (`select @@tidb_instance_plan_cache_max_size` ).Check (testkit .Rows ("1234560000 " ))
50
63
tk .MustExec (`set global tidb_instance_plan_cache_reserved_percentage=-1` )
51
64
tk .MustQuery (`show warnings` ).Check (testkit .Rows (`Warning 1292 Truncated incorrect tidb_instance_plan_cache_reserved_percentage value: '-1'` ))
52
65
tk .MustExec (`set global tidb_instance_plan_cache_reserved_percentage=1.1100` )
0 commit comments