Merge pull request #13721 from fuweid/disable-bbolt-stat-api

*: disable bbolt stat usage
This commit is contained in:
Maksym Pavlenko
2026-07-05 19:33:46 +00:00
committed by GitHub
3 changed files with 18 additions and 1 deletions

View File

@@ -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

View File

@@ -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 {

View File

@@ -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)
}