Skip to content

Commit

Permalink
Feedbacks
Browse files Browse the repository at this point in the history
Signed-off-by: Ashmita Bohara <ashmita.bohara152@gmail.com>
  • Loading branch information
Ashmita152 committed Jun 21, 2021
1 parent 559edaa commit ee86e43
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 1 addition & 3 deletions plugin/storage/badger/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ type NamespaceConfig struct {
SyncWrites bool `mapstructure:"consistency"`
MaintenanceInterval time.Duration `mapstructure:"maintenance_interval"`
MetricsUpdateInterval time.Duration `mapstructure:"metrics_update_interval"`
Truncate bool `mapstructure:"truncate"`
ReadOnly bool `mapstructure:"read_only"`
}

Expand Down Expand Up @@ -139,7 +138,7 @@ func addFlags(flagSet *flag.FlagSet, nsConfig NamespaceConfig) {
)
flagSet.Bool(
nsConfig.namespace+suffixTruncate,
nsConfig.Truncate,
false,
truncateWarning+" If write-ahead-log should be truncated on restart. This will cause data loss.",
)
flagSet.Bool(
Expand All @@ -162,7 +161,6 @@ func initFromViper(cfg *NamespaceConfig, v *viper.Viper, logger *zap.Logger) {
cfg.SpanStoreTTL = v.GetDuration(cfg.namespace + suffixSpanstoreTTL)
cfg.MaintenanceInterval = v.GetDuration(cfg.namespace + suffixMaintenanceInterval)
cfg.MetricsUpdateInterval = v.GetDuration(cfg.namespace + suffixMetricsInterval)
cfg.Truncate = v.GetBool(cfg.namespace + suffixTruncate)
cfg.ReadOnly = v.GetBool(cfg.namespace + suffixReadOnly)
if v.IsSet(cfg.namespace + suffixTruncate) {
logger.Warn("NOTE: Deprecated flag --badger.truncate passed " + truncateWarning)
Expand Down
2 changes: 0 additions & 2 deletions plugin/storage/badger/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func TestParseOptions(t *testing.T) {
assert.Equal(t, "/var/lib/badger", opts.GetPrimary().KeyDirectory)
assert.Equal(t, "/mnt/slow/badger", opts.GetPrimary().ValueDirectory)
assert.False(t, opts.GetPrimary().ReadOnly)
assert.False(t, opts.GetPrimary().Truncate)
}

func TestTruncateAndReadOnlyOptions(t *testing.T) {
Expand All @@ -66,5 +65,4 @@ func TestTruncateAndReadOnlyOptions(t *testing.T) {
opts.InitFromViper(v, zap.NewNop())

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

0 comments on commit ee86e43

Please sign in to comment.