Skip to content

Commit

Permalink
Recsplit: collision typed error (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlexSharov authored Nov 7, 2021
1 parent 138a208 commit f6b0a0c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion recsplit/recsplit.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
"github.com/spaolacci/murmur3"
)

var ErrCollision = fmt.Errorf("duplicate key")

const RecSplitLogPrefix = "recsplit"

const MaxLeafSize = 24
Expand Down Expand Up @@ -298,7 +300,7 @@ func (rs *RecSplit) recsplitCurrentBucket() error {
for i, key := range rs.currentBucket[1:] {
if key == rs.currentBucket[i] {
rs.collision = true
return fmt.Errorf("duplicate key %x", key)
return fmt.Errorf("%w: %x", ErrCollision, key)
}
}
bitPos := rs.gr.bitCount
Expand Down

0 comments on commit f6b0a0c

Please sign in to comment.