Skip to content

Commit

Permalink
add experimental-snapshot-catchup-entries flag.
Browse files Browse the repository at this point in the history
Signed-off-by: Siyuan Zhang <[email protected]>
  • Loading branch information
siyuanfoundation committed Apr 16, 2024
1 parent dad2bab commit 464df4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/embed/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
1 change: 1 addition & 0 deletions server/etcdmain/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
5 changes: 4 additions & 1 deletion server/etcdmain/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 464df4a

Please sign in to comment.