mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
*: add flag to let etcd use the new boltdb freelistType feature
This commit is contained in:
@@ -37,6 +37,7 @@ import (
|
||||
"go.etcd.io/etcd/pkg/types"
|
||||
|
||||
"github.com/ghodss/yaml"
|
||||
bolt "go.etcd.io/bbolt"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
@@ -75,6 +76,8 @@ const (
|
||||
// maxElectionMs specifies the maximum value of election timeout.
|
||||
// More details are listed in ../Documentation/tuning.md#time-parameters.
|
||||
maxElectionMs = 50000
|
||||
// backend freelist map type
|
||||
freelistMapType = "map"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -273,6 +276,8 @@ type Config struct {
|
||||
ExperimentalInitialCorruptCheck bool `json:"experimental-initial-corrupt-check"`
|
||||
ExperimentalCorruptCheckTime time.Duration `json:"experimental-corrupt-check-time"`
|
||||
ExperimentalEnableV2V3 string `json:"experimental-enable-v2v3"`
|
||||
// ExperimentalBackendFreelistType specifies the type of freelist that boltdb backend uses (array and map are supported types).
|
||||
ExperimentalBackendFreelistType string `json:"experimental-backend-bbolt-freelist-type"`
|
||||
|
||||
// ForceNewCluster starts a new cluster even if previously started; unsafe.
|
||||
ForceNewCluster bool `json:"force-new-cluster"`
|
||||
@@ -896,3 +901,11 @@ func (cfg *Config) getMetricsURLs() (ss []string) {
|
||||
}
|
||||
return ss
|
||||
}
|
||||
|
||||
func parseBackendFreelistType(freelistType string) bolt.FreelistType {
|
||||
if freelistType == freelistMapType {
|
||||
return bolt.FreelistMapType
|
||||
}
|
||||
|
||||
return bolt.FreelistArrayType
|
||||
}
|
||||
|
||||
@@ -159,6 +159,8 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
|
||||
return e, err
|
||||
}
|
||||
|
||||
backendFreelistType := parseBackendFreelistType(cfg.ExperimentalBackendFreelistType)
|
||||
|
||||
srvcfg := etcdserver.ServerConfig{
|
||||
Name: cfg.Name,
|
||||
ClientURLs: cfg.ACUrls,
|
||||
@@ -182,6 +184,7 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
|
||||
AutoCompactionMode: cfg.AutoCompactionMode,
|
||||
QuotaBackendBytes: cfg.QuotaBackendBytes,
|
||||
BackendBatchLimit: cfg.BackendBatchLimit,
|
||||
BackendFreelistType: backendFreelistType,
|
||||
BackendBatchInterval: cfg.BackendBatchInterval,
|
||||
MaxTxnOps: cfg.MaxTxnOps,
|
||||
MaxRequestBytes: cfg.MaxRequestBytes,
|
||||
|
||||
Reference in New Issue
Block a user