diff --git a/server/embed/config.go b/server/embed/config.go index b14c0586069..084796812a2 100644 --- a/server/embed/config.go +++ b/server/embed/config.go @@ -151,7 +151,7 @@ type Config struct { // follower to catch up. // WARNING: only change this for tests. // Always use "DefaultSnapshotCatchUpEntries" - SnapshotCatchUpEntries uint64 + SnapshotCatchUpEntries uint64 `json:"experimental-snapshot-catch-up-entries"` MaxSnapFiles uint `json:"max-snapshots"` MaxWalFiles uint `json:"max-wals"` diff --git a/server/etcdmain/config.go b/server/etcdmain/config.go index 7988f1753da..d26ef3dbf60 100644 --- a/server/etcdmain/config.go +++ b/server/etcdmain/config.go @@ -302,6 +302,7 @@ func newConfig() *config { fs.BoolVar(&cfg.ec.ExperimentalMemoryMlock, "experimental-memory-mlock", cfg.ec.ExperimentalMemoryMlock, "Enable to enforce etcd pages (in particular bbolt) to stay in RAM.") fs.BoolVar(&cfg.ec.ExperimentalTxnModeWriteWithSharedBuffer, "experimental-txn-mode-write-with-shared-buffer", true, "Enable the write transaction to use a shared buffer in its readonly check operations.") fs.UintVar(&cfg.ec.ExperimentalBootstrapDefragThresholdMegabytes, "experimental-bootstrap-defrag-threshold-megabytes", 0, "Enable the defrag during etcd server bootstrap on condition that it will free at least the provided threshold of disk space. Needs to be set to non-zero value to take effect.") + fs.Uint64Var(&cfg.ec.SnapshotCatchUpEntries, "experimental-snapshot-catchup-entries", cfg.ec.SnapshotCatchUpEntries, "Number of entries for a slow follower to catch up after compacting the raft storage entries. (WARNING: only use this flag for tests.)") // unsafe fs.BoolVar(&cfg.ec.UnsafeNoFsync, "unsafe-no-fsync", false, "Disables fsync, unsafe, will cause data loss.") diff --git a/server/etcdmain/config_test.go b/server/etcdmain/config_test.go index 736f9af2bb9..7ace5066a99 100644 --- a/server/etcdmain/config_test.go +++ b/server/etcdmain/config_test.go @@ -505,7 +505,10 @@ func TestFlagsPresentInHelp(t *testing.T) { // Ignored flags do not need to be in the help return } - + if f.Name == "experimental-snapshot-catchup-entries" { + // Ignore because it is supposed to only be used in tests. + return + } flagText := fmt.Sprintf("--%s", f.Name) if !strings.Contains(flagsline, flagText) && !strings.Contains(usageline, flagText) { t.Errorf("Neither flagsline nor usageline in help.go contains flag named %s", flagText)