Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,12 @@ func TestSetVar(t *testing.T) {
tk.MustExec("set session tidb_dml_batch_size = -120")
tk.MustQuery(`show warnings`).Check(testkit.Rows("Warning 1292 Truncated incorrect tidb_dml_batch_size value: '-120'")) // without redaction

tk.MustExec("set global tidb_gogc_tuner_min_value=300")
tk.MustQuery("show warnings").Check(testkit.Rows())
tk.MustExec("set global tidb_gogc_tuner_max_value=600")
tk.MustQuery("show warnings").Check(testkit.Rows())
tk.MustExec("set global tidb_gogc_tuner_max_value=600000000000000000")
tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1292 Truncated incorrect tidb_gogc_tuner_max_value value: '600000000000000000'"))
tk.MustExec("set @@session.tidb_dml_batch_size = 120")
tk.MustExec("set @@global.tidb_dml_batch_size = 200") // now permitted due to TiDB #19809
tk.MustQuery("select @@tidb_dml_batch_size;").Check(testkit.Rows("120")) // global only applies to new sessions
Expand Down
4 changes: 2 additions & 2 deletions pkg/sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ var defaultSysVars = []*SysVar{
return nil
}},
{Scope: ScopeGlobal, Name: TiDBGOGCTunerMaxValue, Value: strconv.Itoa(DefTiDBGOGCMaxValue),
Type: TypeInt, MinValue: 10, SetGlobal: func(_ context.Context, s *SessionVars, val string) error {
Type: TypeInt, MinValue: 10, MaxValue: math.MaxInt32, SetGlobal: func(_ context.Context, s *SessionVars, val string) error {
maxValue := TidbOptInt64(val, DefTiDBGOGCMaxValue)
gctuner.SetMaxGCPercent(uint32(maxValue))
gctuner.GlobalMemoryLimitTuner.UpdateMemoryLimit()
Expand All @@ -847,7 +847,7 @@ var defaultSysVars = []*SysVar{
return origin, nil
}},
{Scope: ScopeGlobal, Name: TiDBGOGCTunerMinValue, Value: strconv.Itoa(DefTiDBGOGCMinValue),
Type: TypeInt, MinValue: 10, SetGlobal: func(_ context.Context, s *SessionVars, val string) error {
Type: TypeInt, MinValue: 10, MaxValue: math.MaxInt32, SetGlobal: func(_ context.Context, s *SessionVars, val string) error {
minValue := TidbOptInt64(val, DefTiDBGOGCMinValue)
gctuner.SetMinGCPercent(uint32(minValue))
gctuner.GlobalMemoryLimitTuner.UpdateMemoryLimit()
Expand Down