Skip to content

Commit

Permalink
fix: skip list put operation as set when key exists
Browse files Browse the repository at this point in the history
  • Loading branch information
roseduan committed Jan 15, 2022
1 parent 9e0b271 commit 5f5cb00
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arenaskl/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ func (it *Iterator) SeekForPrev(key []byte) (found bool) {
// on the most current value and returns ErrRecordExists. If there isn't enough
// room in the arena, then Add returns ErrArenaFull.
func (it *Iterator) Put(key []byte, val []byte) error {
if found := it.Seek(key); found {
return it.Set(val)
}
var spl [maxHeight]splice
if it.seekForSplice(key, &spl) {
// Found a matching node, but handle case where it's been deleted.
Expand Down

0 comments on commit 5f5cb00

Please sign in to comment.