-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
In the constructor for Pebble DB, it's impossible to set any of the useful pebble db options. In particular, this makes it impossible to open the database in read only mode, which is required to be able to safely read information without accidentally tampering anything.
func NewPebbleDB(name string, dir string, opts Options) (DB, error) {
do := &pebble.Options{
Logger: &fatalLogger{}, // pebble info logs are messing up the logs (not a cosmossdk.io/log logger)
MaxConcurrentCompactions: func() int { return 3 }, // default 1
}
do.EnsureDefaults()
if opts != nil {
files := cast.ToInt(opts.Get("maxopenfiles"))
if files > 0 {
do.MaxOpenFiles = files
}
}
dbPath := filepath.Join(dir, name+DBFileSuffix)
p, err := pebble.Open(dbPath, do)
if err != nil {
return nil, err
}
return &PebbleDB{
db: p,
}, err
}Can we change it to the following?
func NewPebbleDB(name string, dir string, opts *pebble.Options) (dbm.DB, error) {
if opts == nil {
opts = &pebble.Options{}
}
opts.EnsureDefaults()
dbPath := filepath.Join(dir, name+dbm.DBFileSuffix)
p, err := pebble.Open(dbPath, opts)
if err != nil {
return nil, err
}
return &PebbleDB{
db: p,
}, err
}Metadata
Metadata
Assignees
Labels
No labels