channeldb + wtdb: specify freelist bbolt options by default
This commit specifies two bbolt options when opening the underlying channel and watchtower databases so that there is reduced heap pressure in case the bbolt database has a lot of free pages in the B+ tree.
This commit is contained in:
parent
4fd78926d4
commit
66d15c8e76
@ -135,7 +135,14 @@ func Open(dbPath string, modifiers ...OptionModifier) (*DB, error) {
|
|||||||
modifier(&opts)
|
modifier(&opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
bdb, err := bbolt.Open(path, dbFilePermission, nil)
|
// Specify bbolt freelist options to reduce heap pressure in case the
|
||||||
|
// freelist grows to be very large.
|
||||||
|
options := &bbolt.Options{
|
||||||
|
NoFreelistSync: true,
|
||||||
|
FreelistType: bbolt.FreelistMapType,
|
||||||
|
}
|
||||||
|
|
||||||
|
bdb, err := bbolt.Open(path, dbFilePermission, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,14 @@ func createDBIfNotExist(dbPath, name string) (*bbolt.DB, bool, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bdb, err := bbolt.Open(path, dbFilePermission, nil)
|
// Specify bbolt freelist options to reduce heap pressure in case the
|
||||||
|
// freelist grows to be very large.
|
||||||
|
options := &bbolt.Options{
|
||||||
|
NoFreelistSync: true,
|
||||||
|
FreelistType: bbolt.FreelistMapType,
|
||||||
|
}
|
||||||
|
|
||||||
|
bdb, err := bbolt.Open(path, dbFilePermission, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user