diff --git a/session/pessimistic_test.go b/session/pessimistic_test.go index a48af4514aba7..bda96b4878031 100644 --- a/session/pessimistic_test.go +++ b/session/pessimistic_test.go @@ -732,6 +732,10 @@ func (s *testPessimisticSuite) TestInnodbLockWaitTimeout(c *C) { tk2.MustQuery(`show variables like "innodb_lock_wait_timeout"`).Check(testkit.Rows("innodb_lock_wait_timeout 3")) tk2.MustExec("set innodb_lock_wait_timeout = 2") tk2.MustQuery(`show variables like "innodb_lock_wait_timeout"`).Check(testkit.Rows("innodb_lock_wait_timeout 2")) + // to check whether it will set to innodb_lock_wait_timeout to max value + tk2.MustExec("set innodb_lock_wait_timeout = 3602") + tk2.MustQuery(`show variables like "innodb_lock_wait_timeout"`).Check(testkit.Rows("innodb_lock_wait_timeout 3600")) + tk2.MustExec("set innodb_lock_wait_timeout = 2") tk3 := testkit.NewTestKitWithInit(c, s.store) tk3.MustQuery(`show variables like "innodb_lock_wait_timeout"`).Check(testkit.Rows("innodb_lock_wait_timeout 3")) diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index 420e994f5485f..ba39e17ae5af4 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -798,7 +798,7 @@ var defaultSysVars = []*SysVar{ }}, {Scope: ScopeGlobal | ScopeSession, Name: WaitTimeout, Value: strconv.FormatInt(DefWaitTimeout, 10), Type: TypeUnsigned, MinValue: 0, MaxValue: secondsPerYear}, {Scope: ScopeGlobal | ScopeSession, Name: InteractiveTimeout, Value: "28800", Type: TypeUnsigned, MinValue: 1, MaxValue: secondsPerYear}, - {Scope: ScopeGlobal | ScopeSession, Name: InnodbLockWaitTimeout, Value: strconv.FormatInt(DefInnodbLockWaitTimeout, 10), Type: TypeUnsigned, MinValue: 1, MaxValue: 1073741824, SetSession: func(s *SessionVars, val string) error { + {Scope: ScopeGlobal | ScopeSession, Name: InnodbLockWaitTimeout, Value: strconv.FormatInt(DefInnodbLockWaitTimeout, 10), Type: TypeUnsigned, MinValue: 1, MaxValue: 3600, SetSession: func(s *SessionVars, val string) error { lockWaitSec := TidbOptInt64(val, DefInnodbLockWaitTimeout) s.LockWaitTimeout = lockWaitSec * 1000 return nil