Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
morgo committed Mar 25, 2022
1 parent 388d8ae commit 3ac96c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions expression/builtin_miscellaneous.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,14 @@ func (b *builtinLockSig) evalInt(row chunk.Row) (int64, bool, error) {
}
// A timeout less than zero is expected to be treated as unlimited.
// Because of our implementation being based on pessimistic locks,
// We set the timeout to the maximum value of innodb_lock_wait_timeout.
if timeout < 0 {
timeout = int64(variable.GetSysVar("innodb_lock_wait_timeout").MaxValue)
}
// We can't have a timeout greater than innodb_lock_wait_timeout.
maxTimeout := int64(variable.GetSysVar("innodb_lock_wait_timeout").MaxValue)
if timeout < 0 || timeout > maxTimeout {
timeout = maxTimeout
}
// Lock names are case insensitive. Because we can't rely on collations
// being enabled on the internal table, we have to lower it.
lockName = strings.ToLower(lockName)
err = b.ctx.GetAdvisoryLock(lockName, timeout)
if err != nil {
switch err.(*terror.Error).Code() {
Expand Down Expand Up @@ -259,6 +263,9 @@ func (b *builtinReleaseLockSig) evalInt(row chunk.Row) (int64, bool, error) {
if err != nil {
return 0, isNull, err
}
// Lock names are case insensitive. Because we can't rely on collations
// being enabled on the internal table, we have to lower it.
lockName = strings.ToLower(lockName)
released := int64(0)
if b.ctx.ReleaseAdvisoryLock(lockName) {
released = 1
Expand Down
2 changes: 1 addition & 1 deletion session/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ const (

// currentBootstrapVersion is defined as a variable, so we can modify its value for testing.
// please make sure this is the largest version
var currentBootstrapVersion int64 = version86
var currentBootstrapVersion int64 = version87

var (
bootstrapVersion = []func(Session, int64){
Expand Down

0 comments on commit 3ac96c3

Please sign in to comment.