Skip to content

Commit

Permalink
cmd/utils, node: switch to Pebble as the default db if none exists (#…
Browse files Browse the repository at this point in the history
…27136)
  • Loading branch information
karalabe authored and VM committed Mar 20, 2024
1 parent ebe88c0 commit 3b17f18
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cmd/geth/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ func TestCustomBackend(t *testing.T) {
return nil
}
for i, tt := range []backendTest{
{ // When not specified, it should default to leveldb
execArgs: []string{"--db.engine", "leveldb"},
{ // When not specified, it should default to pebble
execArgs: []string{"--db.engine", "pebble"},
execExpect: "0x0000000000001338",
},
{ // Explicit leveldb
Expand Down
11 changes: 4 additions & 7 deletions core/rawdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ type OpenOptions struct {
//
// type == null type != null
// +----------------------------------------
// db is non-existent | leveldb default | specified type
// db is non-existent | pebble default | specified type
// db is existent | from db | specified type (if compatible)
func openKeyValueDatabase(o OpenOptions) (ethdb.Database, error) {
// Reject any unsupported database type
Expand All @@ -527,12 +527,9 @@ func openKeyValueDatabase(o OpenOptions) (ethdb.Database, error) {
log.Info("Using leveldb as the backing database")
return NewLevelDBDatabase(o.Directory, o.Cache, o.Handles, o.Namespace, o.ReadOnly)
}
// No pre-existing database, no user-requested one either. Default to Pebble
// on supported platforms and LevelDB on anything else.
// log.Info("Defaulting to pebble as the backing database")
// return NewPebbleDBDatabase(o.Directory, o.Cache, o.Handles, o.Namespace, o.ReadOnly)
log.Info("Defaulting to leveldb as the backing database")
return NewLevelDBDatabase(o.Directory, o.Cache, o.Handles, o.Namespace, o.ReadOnly)
// No pre-existing database, no user-requested one either. Default to Pebble.
log.Info("Defaulting to pebble as the backing database")
return NewPebbleDBDatabase(o.Directory, o.Cache, o.Handles, o.Namespace, o.ReadOnly, o.Ephemeral)
}

// Open opens both a disk-based key-value database such as leveldb or pebble, but also
Expand Down
2 changes: 1 addition & 1 deletion node/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var DefaultConfig = Config{
MaxPeersPerIP: 0, // by default, it will be same as MaxPeers
NAT: nat.Any(),
},
DBEngine: "", // Use whatever exists, will default to Leveldb if non-existent and supported
DBEngine: "", // Use whatever exists, will default to Pebble if non-existent and supported
}

// DefaultDataDir is the default data directory to use for the databases and other
Expand Down

0 comments on commit 3b17f18

Please sign in to comment.