cmd/utils, node: switch to Pebble as the default db if none exists (#27136)

* cmd/utils, node: switch to Pebble as the default db if none exists

* node: fall back to LevelDB on platforms not supporting Pebble

* core/rawdb, node: default to Pebble at the node level

* cmd/geth: fix some tests explicitly using leveldb

* ethdb/pebble: allow double closes, makes tests simpler
This commit is contained in:
Péter Szilágyi
2023-04-21 19:24:18 +03:00
committed by GitHub
parent bbc565ab05
commit d3ece3a07c
6 changed files with 42 additions and 28 deletions
+10 -7
View File
@@ -222,14 +222,17 @@ func (d *Database) Close() error {
d.quitLock.Lock()
defer d.quitLock.Unlock()
if d.quitChan != nil {
errc := make(chan error)
d.quitChan <- errc
if err := <-errc; err != nil {
d.log.Error("Metrics collection failed", "err", err)
}
d.quitChan = nil
// Allow double closing, simplifies things
if d.quitChan == nil {
return nil
}
errc := make(chan error)
d.quitChan <- errc
if err := <-errc; err != nil {
d.log.Error("Metrics collection failed", "err", err)
}
d.quitChan = nil
return d.db.Close()
}