Skip to content

Commit

Permalink
Merge pull request #19036 from ahrtr/maxsnapshot_20241210
Browse files Browse the repository at this point in the history
Mark --max-snapshots as deprecated in 3.6 and will be decommissioned …
  • Loading branch information
ahrtr authored Dec 11, 2024
2 parents 39d9cd7 + 4bdf0d2 commit 3cf550d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion server/embed/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ type Config struct {
// follower to catch up.
SnapshotCatchUpEntries uint64 `json:"experimental-snapshot-catch-up-entries"`

// MaxSnapFiles is deprecated in v3.6 and will be decommissioned in v3.7.
// TODO: remove it in 3.7.
MaxSnapFiles uint `json:"max-snapshots"`
//revive:disable-next-line:var-naming
MaxWalFiles uint `json:"max-wals"`
Expand Down Expand Up @@ -617,7 +619,7 @@ func (cfg *Config) AddFlags(fs *flag.FlagSet) {
"listen-metrics-urls",
"List of URLs to listen on for the metrics and health endpoints.",
)
fs.UintVar(&cfg.MaxSnapFiles, "max-snapshots", cfg.MaxSnapFiles, "Maximum number of snapshot files to retain (0 is unlimited).")
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.")
fs.UintVar(&cfg.MaxWalFiles, "max-wals", cfg.MaxWalFiles, "Maximum number of wal files to retain (0 is unlimited).")
fs.StringVar(&cfg.Name, "name", cfg.Name, "Human-readable name for this member.")
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.")
Expand Down
1 change: 1 addition & 0 deletions server/etcdmain/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var (
deprecatedFlags = map[string]string{
// TODO: remove in 3.7.
"snapshot-count": "--snapshot-count is deprecated in 3.6 and will be decommissioned in 3.7.",
"max-snapshots": "--max-snapshots is deprecated in 3.6 and will be decommissioned in 3.7.",
"v2-deprecation": "--v2-deprecation is deprecated and scheduled for removal in v3.8. The default value is enforced, ignoring user input.",
}
)
Expand Down
2 changes: 1 addition & 1 deletion server/etcdmain/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Member:
--listen-client-http-urls ''
List of URLs to listen on for http only client traffic. Enabling this flag removes http services from --listen-client-urls.
--max-snapshots '` + strconv.Itoa(embed.DefaultMaxSnapshots) + `'
Maximum number of snapshot files to retain (0 is unlimited).
Maximum number of snapshot files to retain (0 is unlimited). Deprecated in v3.6 and will be decommissioned in v3.7.
--max-wals '` + strconv.Itoa(embed.DefaultMaxWALs) + `'
Maximum number of wal files to retain (0 is unlimited).
--quota-backend-bytes '0'
Expand Down
5 changes: 5 additions & 0 deletions tests/e2e/etcd_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,11 @@ func TestEtcdDeprecatedFlags(t *testing.T) {
args: append(commonArgs, "--snapshot-count=100"),
expectedMsg: "--snapshot-count is deprecated in 3.6 and will be decommissioned in 3.7",
},
{
name: "max-snapshots",
args: append(commonArgs, "--max-snapshots=10"),
expectedMsg: "--max-snapshots is deprecated in 3.6 and will be decommissioned in 3.7",
},
{
name: "v2-deprecation",
args: append(commonArgs, "--v2-deprecation", "write-only-drop-data"),
Expand Down

0 comments on commit 3cf550d

Please sign in to comment.