Skip to content

Commit

Permalink
fix: pebble.Open no longer accept relative path and benchmark do not …
Browse files Browse the repository at this point in the history
…use default config
  • Loading branch information
marino39 committed Mar 21, 2024
1 parent deaf9a3 commit 225fc0d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _benchmarks/suites/table_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (s *TokenBalanceSerializer) Deserialize(b []byte, tb **TokenBalance) error
const dbName = "bench_db"

func setupDatabase(serializer ...bond.Serializer[any]) bond.DB {
options := &bond.Options{}
options := bond.DefaultOptions()
if len(serializer) > 0 && serializer[0] != nil {
options.Serializer = serializer[0]
}
Expand Down
10 changes: 10 additions & 0 deletions bond.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io/fs"
"math"
"os"
"path"
"path/filepath"
"strconv"
"strings"
Expand Down Expand Up @@ -144,6 +145,15 @@ func Open(dirname string, opts *Options) (DB, error) {
opts.PebbleOptions = DefaultPebbleOptions()
}

if !strings.HasPrefix(dirname, "/") {
wd, err := os.Getwd()
if err != nil {
return nil, err
}

dirname = path.Clean(path.Join(wd, dirname))
}

bondPath := filepath.Join(dirname, "bond")
_, err := os.Stat(bondPath)
if err != nil && !os.IsNotExist(err) {
Expand Down

0 comments on commit 225fc0d

Please sign in to comment.