From f62ea1ceca63bc061e33a1a823e79f5e160a2516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E6=85=95?= Date: Wed, 16 Oct 2019 16:39:29 +0800 Subject: [PATCH] *: promote the boltdb-freelistType from experimental to official and set default type to hashmap --- Documentation/op-guide/configuration.md | 10 +++++----- embed/config.go | 20 ++++++++++---------- embed/etcd.go | 2 +- etcdmain/config.go | 2 +- etcdmain/help.go | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Documentation/op-guide/configuration.md b/Documentation/op-guide/configuration.md index 87075f2e5..8f708c2a5 100644 --- a/Documentation/op-guide/configuration.md +++ b/Documentation/op-guide/configuration.md @@ -89,6 +89,11 @@ To start etcd automatically using custom settings at startup in Linux, using a [ + default: 0 + env variable: ETCD_BACKEND_BATCH_LIMIT +### --backend-bbolt-freelist-type ++ The freelist type that etcd backend(bboltdb) uses (array and map are supported types). ++ default: map ++ env variable: ETCD_BACKEND_BBOLT_FREELIST_TYPE + ### --backend-batch-interval + BackendBatchInterval is the maximum time before commit the backend transaction. + default: 0 @@ -436,11 +441,6 @@ Follow the instructions when using these flags. ## Experimental flags -### --experimental-backend-bbolt-freelist-type -+ The freelist type that etcd backend(bboltdb) uses (array and map are supported types). -+ default: array -+ env variable: ETCD_EXPERIMENTAL_BACKEND_BBOLT_FREELIST_TYPE - ### --experimental-corrupt-check-time + Duration of time between cluster corruption check passes + default: 0s diff --git a/embed/config.go b/embed/config.go index 2f64d927f..2b44cf05d 100644 --- a/embed/config.go +++ b/embed/config.go @@ -77,7 +77,7 @@ const ( // More details are listed in ../Documentation/tuning.md#time-parameters. maxElectionMs = 50000 // backend freelist map type - freelistMapType = "map" + freelistArrayType = "array" ) var ( @@ -171,10 +171,12 @@ type Config struct { // BackendBatchInterval is the maximum time before commit the backend transaction. BackendBatchInterval time.Duration `json:"backend-batch-interval"` // BackendBatchLimit is the maximum operations before commit the backend transaction. - BackendBatchLimit int `json:"backend-batch-limit"` - QuotaBackendBytes int64 `json:"quota-backend-bytes"` - MaxTxnOps uint `json:"max-txn-ops"` - MaxRequestBytes uint `json:"max-request-bytes"` + BackendBatchLimit int `json:"backend-batch-limit"` + // BackendFreelistType specifies the type of freelist that boltdb backend uses (array and map are supported types). + BackendFreelistType string `json:"backend-bbolt-freelist-type"` + QuotaBackendBytes int64 `json:"quota-backend-bytes"` + MaxTxnOps uint `json:"max-txn-ops"` + MaxRequestBytes uint `json:"max-request-bytes"` LPUrls, LCUrls []url.URL APUrls, ACUrls []url.URL @@ -276,8 +278,6 @@ 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"` // ExperimentalEnableLeaseCheckpoint enables primary lessor to persist lease remainingTTL to prevent indefinite auto-renewal of long lived leases. ExperimentalEnableLeaseCheckpoint bool `json:"experimental-enable-lease-checkpoint"` ExperimentalCompactionBatchLimit int `json:"experimental-compaction-batch-limit"` @@ -907,9 +907,9 @@ func (cfg *Config) getMetricsURLs() (ss []string) { } func parseBackendFreelistType(freelistType string) bolt.FreelistType { - if freelistType == freelistMapType { - return bolt.FreelistMapType + if freelistType == freelistArrayType { + return bolt.FreelistArrayType } - return bolt.FreelistArrayType + return bolt.FreelistMapType } diff --git a/embed/etcd.go b/embed/etcd.go index ac7dbc987..c9301bc25 100644 --- a/embed/etcd.go +++ b/embed/etcd.go @@ -159,7 +159,7 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) { return e, err } - backendFreelistType := parseBackendFreelistType(cfg.ExperimentalBackendFreelistType) + backendFreelistType := parseBackendFreelistType(cfg.BackendFreelistType) srvcfg := etcdserver.ServerConfig{ Name: cfg.Name, diff --git a/etcdmain/config.go b/etcdmain/config.go index 3eaa9babb..9e6f5460a 100644 --- a/etcdmain/config.go +++ b/etcdmain/config.go @@ -155,6 +155,7 @@ func newConfig() *config { fs.UintVar(&cfg.ec.ElectionMs, "election-timeout", cfg.ec.ElectionMs, "Time (in milliseconds) for an election to timeout.") fs.BoolVar(&cfg.ec.InitialElectionTickAdvance, "initial-election-tick-advance", cfg.ec.InitialElectionTickAdvance, "Whether to fast-forward initial election ticks on boot for faster election.") fs.Int64Var(&cfg.ec.QuotaBackendBytes, "quota-backend-bytes", cfg.ec.QuotaBackendBytes, "Raise alarms when backend size exceeds the given quota. 0 means use the default quota.") + fs.StringVar(&cfg.ec.BackendFreelistType, "backend-bbolt-freelist-type", cfg.ec.BackendFreelistType, "BackendFreelistType specifies the type of freelist that boltdb backend uses(array and map are supported types)") fs.DurationVar(&cfg.ec.BackendBatchInterval, "backend-batch-interval", cfg.ec.BackendBatchInterval, "BackendBatchInterval is the maximum time before commit the backend transaction.") fs.IntVar(&cfg.ec.BackendBatchLimit, "backend-batch-limit", cfg.ec.BackendBatchLimit, "BackendBatchLimit is the maximum operations before commit the backend transaction.") fs.UintVar(&cfg.ec.MaxTxnOps, "max-txn-ops", cfg.ec.MaxTxnOps, "Maximum number of operations permitted in a transaction.") @@ -253,7 +254,6 @@ func newConfig() *config { fs.BoolVar(&cfg.ec.ExperimentalInitialCorruptCheck, "experimental-initial-corrupt-check", cfg.ec.ExperimentalInitialCorruptCheck, "Enable to check data corruption before serving any client/peer traffic.") fs.DurationVar(&cfg.ec.ExperimentalCorruptCheckTime, "experimental-corrupt-check-time", cfg.ec.ExperimentalCorruptCheckTime, "Duration of time between cluster corruption check passes.") fs.StringVar(&cfg.ec.ExperimentalEnableV2V3, "experimental-enable-v2v3", cfg.ec.ExperimentalEnableV2V3, "v3 prefix for serving emulated v2 state.") - fs.StringVar(&cfg.ec.ExperimentalBackendFreelistType, "experimental-backend-bbolt-freelist-type", cfg.ec.ExperimentalBackendFreelistType, "ExperimentalBackendFreelistType specifies the type of freelist that boltdb backend uses(array and map are supported types)") fs.BoolVar(&cfg.ec.ExperimentalEnableLeaseCheckpoint, "experimental-enable-lease-checkpoint", false, "Enable to persist lease remaining TTL to prevent indefinite auto-renewal of long lived leases.") fs.IntVar(&cfg.ec.ExperimentalCompactionBatchLimit, "experimental-compaction-batch-limit", cfg.ec.ExperimentalCompactionBatchLimit, "Sets the maximum revisions deleted in each compaction batch.") diff --git a/etcdmain/help.go b/etcdmain/help.go index d30429562..244b798cf 100644 --- a/etcdmain/help.go +++ b/etcdmain/help.go @@ -69,6 +69,8 @@ Member: Maximum number of wal files to retain (0 is unlimited). --quota-backend-bytes '0' Raise alarms when backend size exceeds the given quota (0 defaults to low space quota). + --backend-bbolt-freelist-type 'map' + BackendFreelistType specifies the type of freelist that boltdb backend uses(array and map are supported types). --backend-batch-interval '' BackendBatchInterval is the maximum time before commit the backend transaction. --backend-batch-limit '0' @@ -200,8 +202,6 @@ Experimental feature: Duration of time between cluster corruption check passes. --experimental-enable-v2v3 '' Serve v2 requests through the v3 backend under a given prefix. - --experimental-backend-bbolt-freelist-type 'array' - ExperimentalBackendFreelistType specifies the type of freelist that boltdb backend uses(array and map are supported types). --experimental-enable-lease-checkpoint 'false' ExperimentalEnableLeaseCheckpoint enables primary lessor to persist lease remainingTTL to prevent indefinite auto-renewal of long lived leases. --experimental-compaction-batch-limit 1000