Merge pull request #86 from sanimej/bugfix
boltDB AtomicDelete fails for non-existent key
This commit is contained in:
commit
99db1f6a07
1 changed files with 3 additions and 0 deletions
|
@ -330,6 +330,9 @@ func (b *BoltDB) AtomicDelete(key string, previous *store.KVPair) (bool, error)
|
|||
}
|
||||
|
||||
val = bucket.Get([]byte(key))
|
||||
if val == nil {
|
||||
return store.ErrKeyNotFound
|
||||
}
|
||||
dbIndex := binary.LittleEndian.Uint64(val[:libkvmetadatalen])
|
||||
if dbIndex != previous.LastIndex {
|
||||
return store.ErrKeyModified
|
||||
|
|
Loading…
Add table
Reference in a new issue