Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
firelizzard18 committed Sep 30, 2023
1 parent c43fce6 commit 4bf605d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 3 additions & 1 deletion internal/database/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,9 @@ func writeSnapshotIndex(w *snapshot.Writer, index *indexing.Bucket, opts *Collec
Section: int(binary.BigEndian.Uint64(e.Value)),
Offset: binary.BigEndian.Uint64(e.Value[8:]),
})
return errors.UnknownError.Wrap(err)
if err != nil {
return errors.UnknownError.Wrap(err)
}
}
}

Expand Down
5 changes: 2 additions & 3 deletions internal/util/indexing/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const pageSize = 1 << 10 // 1024 entries

// Bucket is a collection of 256 files.
type Bucket struct {
files map[byte]*bucketFile
files [256]*bucketFile
valueSize int
}

Expand All @@ -39,7 +39,6 @@ func OpenBucket(prefix string, valueSize int, create bool) (*Bucket, error) {
b.valueSize = valueSize

// Create a file for every byte prefix
b.files = make(map[byte]*bucketFile, 256)
for i := 0; i < 256; i++ {
name := fmt.Sprintf("%s%02x", prefix, i)

Expand All @@ -52,7 +51,7 @@ func OpenBucket(prefix string, valueSize int, create bool) (*Bucket, error) {
if err != nil {
return nil, err
}
b.files[byte(i)] = &bucketFile{file: file}
b.files[i] = &bucketFile{file: file}
}

return b, nil
Expand Down

0 comments on commit 4bf605d

Please sign in to comment.