Skip to content

Commit

Permalink
Fixed the problem of updating lock data to perform rewrite operation …
Browse files Browse the repository at this point in the history
…by immediately expiring Lock command.
  • Loading branch information
snower committed Apr 21, 2024
1 parent bf7409b commit 7c85e92
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions server/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -2326,11 +2326,6 @@ func (self *LockDB) HasLock(command *protocol.LockCommand, aofLockData []byte) b
lockManager.glock.Unlock()
return false
}
currentLock := lockManager.GetLockedLock(command)
if currentLock == nil {
lockManager.glock.Unlock()
return false
}
if command.ExpriedFlag&0x4440 == 0 && command.Expried == 0 {
if aofLockData == nil || lockManager.currentData == nil || lockManager.currentData.data == nil || len(aofLockData) != len(lockManager.currentData.data) {
lockManager.glock.Unlock()
Expand All @@ -2343,6 +2338,13 @@ func (self *LockDB) HasLock(command *protocol.LockCommand, aofLockData []byte) b
return false
}
}
lockManager.glock.Unlock()
return true
}
currentLock := lockManager.GetLockedLock(command)
if currentLock == nil {
lockManager.glock.Unlock()
return false
}
lockManager.glock.Unlock()
return true
Expand Down

0 comments on commit 7c85e92

Please sign in to comment.