Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new boltdb options #11895

Merged
merged 6 commits into from
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion physical/raft/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,16 @@ func (f *FSM) openDBFile(dbPath string) error {
return errors.New("can not open empty filename")
}

boltDB, err := bolt.Open(dbPath, 0o666, &bolt.Options{Timeout: 1 * time.Second})
start := time.Now()
boltDB, err := bolt.Open(dbPath, 0o666, &bolt.Options{
Timeout: 1 * time.Second,
FreelistType: bolt.FreelistMapType,
NoFreelistSync: true,
ncabatoff marked this conversation as resolved.
Show resolved Hide resolved
})
if err != nil {
return err
}
f.logger.Debug("time to open database", "elapsed", time.Now().Sub(start), "path", dbPath)
raskchanky marked this conversation as resolved.
Show resolved Hide resolved

err = boltDB.Update(func(tx *bolt.Tx) error {
// make sure we have the necessary buckets created
Expand Down
9 changes: 8 additions & 1 deletion physical/raft/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,14 @@ func NewRaftBackend(conf map[string]string, logger log.Logger) (physical.Backend
}

// Create the backend raft store for logs and stable storage.
store, err := raftboltdb.NewBoltStore(filepath.Join(path, "raft.db"))
raftOptions := raftboltdb.Options{
Path: filepath.Join(path, "raft.db"),
BoltOptions: &bolt.Options{
FreelistType: bolt.FreelistMapType,
NoFreelistSync: true,
},
}
store, err := raftboltdb.New(raftOptions)
if err != nil {
return nil, err
}
Expand Down