daemon: configureLocalContentStore: use FreelistMapType for bolt db
From the [DB.FreelistType] GoDoc:
// FreelistType sets the backend freelist type. There are two options. Array which is simple but endures
// dramatic performance degradation if database is large and fragmentation in freelist is common.
// The alternative one is using hashmap, it is faster in almost all circumstances
// but it doesn't guarantee that it offers the smallest page id available. In normal case it is safe.
// The default type is array
FreelistType FreelistType
While the default is still `FreelistArrayType`, the package shows that
the intent is to make `FreelistMapType` the default in future;
https://pkg.go.dev/go.etcd.io/bbolt@v1.5.0#pkg-constants
// TODO(ahrtr): eventually we should (step by step)
// 1. default to `FreelistMapType`;
// 2. remove the `FreelistArrayType`, do not export `FreelistMapType`
// and remove field `FreelistType' from both `DB` and `Options`;
[DB.FreelistType]: https://pkg.go.dev/go.etcd.io/bbolt@v1.5.0#DB.FreelistType
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
1 file changed
+3
-1
+3
-1
@@ -20,7 +20,9 @@ func (daemon *Daemon) configureLocalContentStore(ns string) (*namespacedContent,
|
||||
if err := os.MkdirAll(filepath.Join(daemon.root, "content"), 0o700); err != nil {
|
||||
return nil, nil, errors.Wrap(err, "error creating dir for content store")
|
||||
}
|
||||
db, err := bolt.Open(filepath.Join(daemon.root, "content", "metadata.db"), 0o600, nil)
|
||||
db, err := bolt.Open(filepath.Join(daemon.root, "content", "metadata.db"), 0o600, &bolt.Options{
|
||||
FreelistType: bolt.FreelistMapType,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrap(err, "error opening bolt db for content metadata store")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user