Skip to content

Commit

Permalink
Remove deprecated --badger.truncate CLI flag
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <github@ysh.us>
  • Loading branch information
yurishkuro committed Nov 25, 2021
1 parent 57d4131 commit 2f79412
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
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

#### 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)
}

0 comments on commit 2f79412

Please sign in to comment.