Skip to content

Commit 3cf550d

Browse files
authored
Merge pull request #19036 from ahrtr/maxsnapshot_20241210
Mark --max-snapshots as deprecated in 3.6 and will be decommissioned …
2 parents 39d9cd7 + 4bdf0d2 commit 3cf550d

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

server/embed/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ type Config struct {
169169
// follower to catch up.
170170
SnapshotCatchUpEntries uint64 `json:"experimental-snapshot-catch-up-entries"`
171171

172+
// MaxSnapFiles is deprecated in v3.6 and will be decommissioned in v3.7.
173+
// TODO: remove it in 3.7.
172174
MaxSnapFiles uint `json:"max-snapshots"`
173175
//revive:disable-next-line:var-naming
174176
MaxWalFiles uint `json:"max-wals"`
@@ -617,7 +619,7 @@ func (cfg *Config) AddFlags(fs *flag.FlagSet) {
617619
"listen-metrics-urls",
618620
"List of URLs to listen on for the metrics and health endpoints.",
619621
)
620-
fs.UintVar(&cfg.MaxSnapFiles, "max-snapshots", cfg.MaxSnapFiles, "Maximum number of snapshot files to retain (0 is unlimited).")
622+
fs.UintVar(&cfg.MaxSnapFiles, "max-snapshots", cfg.MaxSnapFiles, "Maximum number of snapshot files to retain (0 is unlimited). Deprecated in v3.6 and will be decommissioned in v3.7.")
621623
fs.UintVar(&cfg.MaxWalFiles, "max-wals", cfg.MaxWalFiles, "Maximum number of wal files to retain (0 is unlimited).")
622624
fs.StringVar(&cfg.Name, "name", cfg.Name, "Human-readable name for this member.")
623625
fs.Uint64Var(&cfg.SnapshotCount, "snapshot-count", cfg.SnapshotCount, "Number of committed transactions to trigger a snapshot to disk. Deprecated in v3.6 and will be decommissioned in v3.7.")

server/etcdmain/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ var (
6060
deprecatedFlags = map[string]string{
6161
// TODO: remove in 3.7.
6262
"snapshot-count": "--snapshot-count is deprecated in 3.6 and will be decommissioned in 3.7.",
63+
"max-snapshots": "--max-snapshots is deprecated in 3.6 and will be decommissioned in 3.7.",
6364
"v2-deprecation": "--v2-deprecation is deprecated and scheduled for removal in v3.8. The default value is enforced, ignoring user input.",
6465
}
6566
)

server/etcdmain/help.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Member:
7272
--listen-client-http-urls ''
7373
List of URLs to listen on for http only client traffic. Enabling this flag removes http services from --listen-client-urls.
7474
--max-snapshots '` + strconv.Itoa(embed.DefaultMaxSnapshots) + `'
75-
Maximum number of snapshot files to retain (0 is unlimited).
75+
Maximum number of snapshot files to retain (0 is unlimited). Deprecated in v3.6 and will be decommissioned in v3.7.
7676
--max-wals '` + strconv.Itoa(embed.DefaultMaxWALs) + `'
7777
Maximum number of wal files to retain (0 is unlimited).
7878
--quota-backend-bytes '0'

tests/e2e/etcd_config_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,11 @@ func TestEtcdDeprecatedFlags(t *testing.T) {
681681
args: append(commonArgs, "--snapshot-count=100"),
682682
expectedMsg: "--snapshot-count is deprecated in 3.6 and will be decommissioned in 3.7",
683683
},
684+
{
685+
name: "max-snapshots",
686+
args: append(commonArgs, "--max-snapshots=10"),
687+
expectedMsg: "--max-snapshots is deprecated in 3.6 and will be decommissioned in 3.7",
688+
},
684689
{
685690
name: "v2-deprecation",
686691
args: append(commonArgs, "--v2-deprecation", "write-only-drop-data"),

0 commit comments

Comments
 (0)