*: add flag to let etcd use the new boltdb freelistType feature

This commit is contained in:
WizardCXY
2019-02-02 15:42:40 +08:00
parent 3e0f0ba40e
commit e6c6d8492e
8 changed files with 32 additions and 0 deletions

View File

@ -110,6 +110,8 @@ type BackendConfig struct {
BatchInterval time.Duration
// BatchLimit is the maximum puts before flushing the BatchTx.
BatchLimit int
// BackendFreelistType is the backend boltdb's freelist type.
BackendFreelistType bolt.FreelistType
// MmapSize is the number of bytes to mmap for the backend.
MmapSize uint64
// Logger logs backend-side operations.
@ -140,6 +142,7 @@ func newBackend(bcfg BackendConfig) *backend {
*bopts = *boltOpenOptions
}
bopts.InitialMmapSize = bcfg.mmapSize()
bopts.FreelistType = bcfg.BackendFreelistType
db, err := bolt.Open(bcfg.Path, 0600, bopts)
if err != nil {