Skip to content

Commit

Permalink
pebble upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong committed Sep 30, 2023
1 parent 23e28f8 commit 15d20c8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions ctxcdb/pebble/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (
"github.com/CortexFoundation/CortexTheseus/ctxcdb"
"github.com/CortexFoundation/CortexTheseus/log"
"github.com/CortexFoundation/CortexTheseus/metrics"

"github.com/cockroachdb/errors"
"github.com/cockroachdb/pebble"
"github.com/cockroachdb/pebble/bloom"
)
Expand Down Expand Up @@ -118,6 +120,15 @@ func (d *Database) onWriteStallEnd() {
d.writeDelayTime.Add(int64(time.Since(d.writeDelayStartTime)))
}

type panicLogger struct{}

func (l panicLogger) Infof(format string, args ...interface{}) {
}

func (l panicLogger) Fatalf(format string, args ...interface{}) {
panic(errors.Errorf("fatal: "+format, args...))
}

// New returns a wrapped pebble DB object. The namespace is the prefix that the
// metrics reporting should use for surfacing internal stats.
func New(file string, cache int, handles int, namespace string, readonly bool, ephemeral bool) (*Database, error) {
Expand Down Expand Up @@ -189,6 +200,7 @@ func New(file string, cache int, handles int, namespace string, readonly bool, e
WriteStallBegin: db.onWriteStallBegin,
WriteStallEnd: db.onWriteStallEnd,
},
Logger: panicLogger{}, // TODO(karalabe): Delete when this is upstreamed in Pebble
}
// Disable seek compaction explicitly. Check https://github.com/CortexFoundation/CortexTheseus/pull/20130
// for more details.
Expand Down Expand Up @@ -308,9 +320,9 @@ func (d *Database) NewBatch() ctxcdb.Batch {
// It's not supported by pebble, but pebble has better memory allocation strategy
// which turns out a lot faster than leveldb. It's performant enough to construct
// batch object without any pre-allocated space.
func (d *Database) NewBatchWithSize(_ int) ctxcdb.Batch {
func (d *Database) NewBatchWithSize(size int) ctxcdb.Batch {
return &batch{
b: d.db.NewBatch(),
b: d.db.NewBatchWithSize(size),
db: d,
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ require (
github.com/cespare/cp v1.1.1
github.com/charmbracelet/bubbletea v0.24.2
github.com/cloudflare/cloudflare-go v0.57.1
github.com/cockroachdb/errors v1.10.0
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593
github.com/consensys/gnark-crypto v0.12.0
github.com/crate-crypto/go-kzg-4844 v0.3.0
Expand Down Expand Up @@ -124,7 +125,6 @@ require (
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
github.com/bwmarrin/snowflake v0.3.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.10.0 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
Expand Down

0 comments on commit 15d20c8

Please sign in to comment.