ethdb/pebble: fix nil callbacks (#26650)

revert-26290-generic-prque-extended
Péter Szilágyi 2 years ago committed by GitHub
parent bf1798e04e
commit da3c974c36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      ethdb/pebble/pebble.go

@ -117,7 +117,6 @@ func (d *Database) onWriteStallEnd() {
// New returns a wrapped pebble DB object. The namespace is the prefix that the // New returns a wrapped pebble DB object. The namespace is the prefix that the
// metrics reporting should use for surfacing internal stats. // metrics reporting should use for surfacing internal stats.
func New(file string, cache int, handles int, namespace string, readonly bool) (*Database, error) { func New(file string, cache int, handles int, namespace string, readonly bool) (*Database, error) {
var db *Database
// Ensure we have some minimal caching and file guarantees // Ensure we have some minimal caching and file guarantees
if cache < minCache { if cache < minCache {
cache = minCache cache = minCache
@ -140,6 +139,11 @@ func New(file string, cache int, handles int, namespace string, readonly bool) (
if memTableSize > maxMemTableSize { if memTableSize > maxMemTableSize {
memTableSize = maxMemTableSize memTableSize = maxMemTableSize
} }
db := &Database{
fn: file,
log: logger,
quitChan: make(chan chan error),
}
opt := &pebble.Options{ opt := &pebble.Options{
// Pebble has a single combined cache area and the write // Pebble has a single combined cache area and the write
// buffers are taken from this too. Assign all available // buffers are taken from this too. Assign all available
@ -187,13 +191,8 @@ func New(file string, cache int, handles int, namespace string, readonly bool) (
if err != nil { if err != nil {
return nil, err return nil, err
} }
// Assemble the wrapper with all the registered metrics db.db = innerDB
db = &Database{
fn: file,
db: innerDB,
log: logger,
quitChan: make(chan chan error),
}
db.compTimeMeter = metrics.NewRegisteredMeter(namespace+"compact/time", nil) db.compTimeMeter = metrics.NewRegisteredMeter(namespace+"compact/time", nil)
db.compReadMeter = metrics.NewRegisteredMeter(namespace+"compact/input", nil) db.compReadMeter = metrics.NewRegisteredMeter(namespace+"compact/input", nil)
db.compWriteMeter = metrics.NewRegisteredMeter(namespace+"compact/output", nil) db.compWriteMeter = metrics.NewRegisteredMeter(namespace+"compact/output", nil)

Loading…
Cancel
Save