mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
*: modify etcd flags to support finner compaction retention
This commit is contained in:
parent
554298d429
commit
733de98cfb
@ -81,7 +81,7 @@ type Config struct {
|
||||
MaxWalFiles uint `json:"max-wals"`
|
||||
Name string `json:"name"`
|
||||
SnapCount uint64 `json:"snapshot-count"`
|
||||
AutoCompactionRetention int `json:"auto-compaction-retention"`
|
||||
AutoCompactionRetention string `json:"auto-compaction-retention"`
|
||||
AutoCompactionMode string `json:"auto-compaction-mode"`
|
||||
|
||||
// TickMs is the number of milliseconds between heartbeat ticks.
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -127,6 +128,20 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
autoCompactionRetention time.Duration
|
||||
h int
|
||||
)
|
||||
h, err = strconv.Atoi(cfg.AutoCompactionRetention)
|
||||
if err == nil {
|
||||
autoCompactionRetention = time.Duration(int64(h)) * time.Hour
|
||||
} else {
|
||||
autoCompactionRetention, err = time.ParseDuration(cfg.AutoCompactionRetention)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error parsing AutoCompactionRetention: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
srvcfg := etcdserver.ServerConfig{
|
||||
Name: cfg.Name,
|
||||
ClientURLs: cfg.ACUrls,
|
||||
@ -145,7 +160,7 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
|
||||
PeerTLSInfo: cfg.PeerTLSInfo,
|
||||
TickMs: cfg.TickMs,
|
||||
ElectionTicks: cfg.ElectionTicks(),
|
||||
AutoCompactionRetention: cfg.AutoCompactionRetention,
|
||||
AutoCompactionRetention: autoCompactionRetention,
|
||||
AutoCompactionMode: cfg.AutoCompactionMode,
|
||||
QuotaBackendBytes: cfg.QuotaBackendBytes,
|
||||
MaxTxnOps: cfg.MaxTxnOps,
|
||||
|
@ -196,8 +196,8 @@ func newConfig() *config {
|
||||
// version
|
||||
fs.BoolVar(&cfg.printVersion, "version", false, "Print the version and exit.")
|
||||
|
||||
fs.IntVar(&cfg.AutoCompactionRetention, "auto-compaction-retention", 0, "Auto compaction retention for mvcc key value store. 0 means disable auto compaction.")
|
||||
fs.StringVar(&cfg.AutoCompactionMode, "auto-compaction-mode", "periodic", "Interpret 'auto-compaction-retention' as hours when 'periodic', as revision numbers when 'revision'.")
|
||||
fs.StringVar(&cfg.AutoCompactionRetention, "auto-compaction-retention", "0", "Auto compaction retention for mvcc key value store. 0 means disable auto compaction.")
|
||||
fs.StringVar(&cfg.AutoCompactionMode, "auto-compaction-mode", "periodic", "interpret 'auto-compaction-retention' one of: periodic|revision. 'periodic' for duration based retention, defaulting to hours if no time unit is provided (e.g. '5m'). 'revision' for revision number based retention.")
|
||||
|
||||
// pprof profiler via HTTP
|
||||
fs.BoolVar(&cfg.EnablePprof, "enable-pprof", false, "Enable runtime profiling data via HTTP server. Address is at client URL + \"/debug/pprof/\"")
|
||||
|
@ -99,7 +99,7 @@ clustering flags:
|
||||
--auto-compaction-retention '0'
|
||||
auto compaction retention length. 0 means disable auto compaction.
|
||||
--auto-compaction-mode 'periodic'
|
||||
'periodic' means hours, 'revision' means revision numbers to retain by auto compaction
|
||||
interpret 'auto-compaction-retention' one of: periodic|revision. 'periodic' for duration based retention, defaulting to hours if no time unit is provided (e.g. '5m'). 'revision' for revision number based retention.
|
||||
--enable-v2
|
||||
Accept etcd V2 client requests.
|
||||
|
||||
|
@ -51,7 +51,7 @@ type ServerConfig struct {
|
||||
ElectionTicks int
|
||||
BootstrapTimeout time.Duration
|
||||
|
||||
AutoCompactionRetention int
|
||||
AutoCompactionRetention time.Duration
|
||||
AutoCompactionMode string
|
||||
QuotaBackendBytes int64
|
||||
MaxTxnOps uint
|
||||
|
Loading…
x
Reference in New Issue
Block a user