From afe511945e24d5ce437e5566abeb1d3585d38885 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Fri, 18 May 2018 14:38:39 -0700 Subject: [PATCH] embed: rename "SnapshotCount", add "SnapshotCatchUpEntries" Signed-off-by: Gyuho Lee --- embed/config.go | 27 ++++++++++++++++++++------- embed/etcd.go | 2 +- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/embed/config.go b/embed/config.go index 4289b615b..597b9cca8 100644 --- a/embed/config.go +++ b/embed/config.go @@ -111,12 +111,23 @@ func init() { // Config holds the arguments for configuring an etcd server. type Config struct { - Name string `json:"name"` - Dir string `json:"data-dir"` - WalDir string `json:"wal-dir"` - SnapCount uint64 `json:"snapshot-count"` - MaxSnapFiles uint `json:"max-snapshots"` - MaxWalFiles uint `json:"max-wals"` + Name string `json:"name"` + Dir string `json:"data-dir"` + WalDir string `json:"wal-dir"` + + SnapshotCount uint64 `json:"snapshot-count"` + + // SnapshotCatchUpEntries is the number of entries for a slow follower + // to catch-up after compacting the raft storage entries. + // We expect the follower has a millisecond level latency with the leader. + // The max throughput is around 10K. Keep a 5K entries is enough for helping + // follower to catch up. + // WARNING: only change this for tests. + // Always use "DefaultSnapshotCatchUpEntries" + SnapshotCatchUpEntries uint64 + + MaxSnapFiles uint `json:"max-snapshots"` + MaxWalFiles uint `json:"max-wals"` // TickMs is the number of milliseconds between heartbeat ticks. // TODO: decouple tickMs and heartbeat tick (current heartbeat tick = 1). @@ -342,7 +353,9 @@ func NewConfig() *Config { Name: DefaultName, - SnapCount: etcdserver.DefaultSnapCount, + SnapshotCount: etcdserver.DefaultSnapshotCount, + SnapshotCatchUpEntries: etcdserver.DefaultSnapshotCatchUpEntries, + MaxTxnOps: DefaultMaxTxnOps, MaxRequestBytes: DefaultMaxRequestBytes, diff --git a/embed/etcd.go b/embed/etcd.go index 50c8f283e..1626a2155 100644 --- a/embed/etcd.go +++ b/embed/etcd.go @@ -163,7 +163,7 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) { PeerURLs: cfg.APUrls, DataDir: cfg.Dir, DedicatedWALDir: cfg.WalDir, - SnapCount: cfg.SnapCount, + SnapshotCount: cfg.SnapshotCount, MaxSnapFiles: cfg.MaxSnapFiles, MaxWALFiles: cfg.MaxWalFiles, InitialPeerURLsMap: urlsmap,