Skip to content

Commit

Permalink
variable: make backoff weight could be 0
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Yu <jackysp@gmail.com>
  • Loading branch information
jackysp committed Mar 22, 2022
1 parent bd008d2 commit df7a73f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func TestSetVar(t *testing.T) {
tk.MustExec("set session tidb_backoff_weight = -1")
tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1292 Truncated incorrect tidb_backoff_weight value: '-1'"))
tk.MustExec("set global tidb_backoff_weight = 0")
tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1292 Truncated incorrect tidb_backoff_weight value: '0'"))
tk.MustQuery("select @@global.tidb_backoff_weight;").Check(testkit.Rows("0"))
tk.MustExec("set global tidb_backoff_weight = 10")
tk.MustQuery("select @@global.tidb_backoff_weight;").Check(testkit.Rows("10"))

Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ var defaultSysVars = []*SysVar{
s.KVVars.BackoffLockFast = tidbOptPositiveInt32(val, tikvstore.DefBackoffLockFast)
return nil
}},
{Scope: ScopeGlobal | ScopeSession, Name: TiDBBackOffWeight, Value: strconv.Itoa(tikvstore.DefBackOffWeight), Type: TypeUnsigned, MinValue: 1, MaxValue: math.MaxInt32, SetSession: func(s *SessionVars, val string) error {
{Scope: ScopeGlobal | ScopeSession, Name: TiDBBackOffWeight, Value: strconv.Itoa(tikvstore.DefBackOffWeight), Type: TypeUnsigned, MinValue: 0, MaxValue: math.MaxInt32, SetSession: func(s *SessionVars, val string) error {
s.KVVars.BackOffWeight = tidbOptPositiveInt32(val, tikvstore.DefBackOffWeight)
return nil
}},
Expand Down

0 comments on commit df7a73f

Please sign in to comment.