mirror of
https://github.com/containerd/containerd.git
synced 2026-08-09 01:21:15 +00:00
Merge pull request #13721 from fuweid/disable-bbolt-stat-api
*: disable bbolt stat usage
This commit is contained in:
@@ -84,6 +84,11 @@ func NewMetaStore(dbfile string, opts ...Opt) (*MetaStore, error) {
|
||||
opts: *bolt.DefaultOptions,
|
||||
}
|
||||
|
||||
// Disable stat usage since we never consume the data.
|
||||
// This can reduce unnecessary contention during transactions.
|
||||
// https://github.com/etcd-io/bbolt/pull/977
|
||||
store.opts.NoStatistics = true
|
||||
|
||||
for _, f := range opts {
|
||||
if err := f(&store.opts); err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -138,6 +138,11 @@ func init() {
|
||||
// Without the timeout, bbolt.Open would block indefinitely due to flock(2).
|
||||
options.Timeout = timeout.Get(boltOpenTimeout)
|
||||
|
||||
// Disable stat usage since we never consume the data.
|
||||
// This can reduce unnecessary contention during transactions.
|
||||
// https://github.com/etcd-io/bbolt/pull/977
|
||||
options.NoStatistics = true
|
||||
|
||||
shared := true
|
||||
ic.Meta.Exports["policy"] = SharingPolicyShared
|
||||
if cfg, ok := ic.Config.(*BoltConfig); ok {
|
||||
|
||||
@@ -81,7 +81,14 @@ func init() {
|
||||
|
||||
metadb := filepath.Join(root, "mounts.db")
|
||||
|
||||
db, err := bolt.Open(metadb, 0600, nil)
|
||||
options := *bolt.DefaultOptions
|
||||
|
||||
// Disable stat usage since we never consume the data.
|
||||
// This can reduce unnecessary contention during transactions.
|
||||
// https://github.com/etcd-io/bbolt/pull/977
|
||||
options.NoStatistics = true
|
||||
|
||||
db, err := bolt.Open(metadb, 0600, &options)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open database file: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user