Merge pull request #3278 from Crypt-iQ/bbolt_options_0707

channeldb: specify freelist bbolt options by default
This commit is contained in:
Olaoluwa Osuntokun
2019-07-30 16:52:28 -07:00
committed by GitHub
4 changed files with 19 additions and 3 deletions

View File

@@ -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 {
return nil, false, err
}