Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated --badger.truncate CLI flag #3410

Merged
merged 2 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changes by Version
next release
-------------------
### Backend Changes
#### Breaking Changes
* Remove deprecated `--badger.truncate` CLI flag in [#3410](https://github.com/jaegertracing/jaeger/pull/3410))

#### New Features

1.28.0 (2021-11-06)
Expand Down
12 changes: 0 additions & 12 deletions plugin/storage/badger/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ type NamespaceConfig struct {
ReadOnly bool `mapstructure:"read_only"`
}

// TODO deprecated flag to be removed
const truncateWarning = "(deprecated, will be removed after 2021-09-21 or in release v1.26.0, whichever is later)"

const (
defaultMaintenanceInterval time.Duration = 5 * time.Minute
defaultMetricsUpdateInterval time.Duration = 10 * time.Second
Expand All @@ -61,7 +58,6 @@ const (
suffixSyncWrite = ".consistency"
suffixMaintenanceInterval = ".maintenance-interval"
suffixMetricsInterval = ".metrics-update-interval" // Intended only for testing purposes
suffixTruncate = ".truncate"
suffixReadOnly = ".read-only"
defaultDataDir = string(os.PathSeparator) + "data"
defaultValueDir = defaultDataDir + string(os.PathSeparator) + "values"
Expand Down Expand Up @@ -136,11 +132,6 @@ func addFlags(flagSet *flag.FlagSet, nsConfig NamespaceConfig) {
nsConfig.MetricsUpdateInterval,
"How often the badger metrics are collected by Jaeger. Format is time.Duration (https://golang.org/pkg/time/#Duration)",
)
flagSet.Bool(
nsConfig.namespace+suffixTruncate,
false,
truncateWarning+" If write-ahead-log should be truncated on restart. This will cause data loss.",
)
flagSet.Bool(
nsConfig.namespace+suffixReadOnly,
nsConfig.ReadOnly,
Expand All @@ -162,9 +153,6 @@ func initFromViper(cfg *NamespaceConfig, v *viper.Viper, logger *zap.Logger) {
cfg.MaintenanceInterval = v.GetDuration(cfg.namespace + suffixMaintenanceInterval)
cfg.MetricsUpdateInterval = v.GetDuration(cfg.namespace + suffixMetricsInterval)
cfg.ReadOnly = v.GetBool(cfg.namespace + suffixReadOnly)
if v.IsSet(cfg.namespace + suffixTruncate) {
logger.Warn("NOTE: Deprecated flag --badger.truncate passed " + truncateWarning)
}
}

// GetPrimary returns the primary namespace configuration
Expand Down
4 changes: 1 addition & 3 deletions plugin/storage/badger/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,12 @@ func TestParseOptions(t *testing.T) {
assert.False(t, opts.GetPrimary().ReadOnly)
}

func TestTruncateAndReadOnlyOptions(t *testing.T) {
func TestReadOnlyOptions(t *testing.T) {
opts := NewOptions("badger")
v, command := config.Viperize(opts.AddFlags)
command.ParseFlags([]string{
"--badger.truncate=true",
"--badger.read-only=true",
})
opts.InitFromViper(v, zap.NewNop())

assert.True(t, opts.GetPrimary().ReadOnly)
}