Skip to content

Commit

Permalink
Remove deprecated global tags setting (#1062)
Browse files Browse the repository at this point in the history
This was added in July 2017 as a backwards-compatibility measure;
removing now nobody uses it.

Signed-off-by: Bryan Boreham <[email protected]>
  • Loading branch information
bboreham authored Oct 8, 2018
1 parent 44fdd67 commit c824ad2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 37 deletions.
37 changes: 1 addition & 36 deletions pkg/chunk/schema_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ type SchemaConfig struct {
UsePeriodicTables bool
IndexTables PeriodicTableConfig
ChunkTables PeriodicTableConfig

// Deprecated configuration for setting tags on all tables.
Tags Tags
}

// RegisterFlags adds the flags required to config this to the given FlagSet.
Expand All @@ -67,12 +64,8 @@ func (cfg *SchemaConfig) RegisterFlags(f *flag.FlagSet) {
f.StringVar(&cfg.OriginalTableName, "dynamodb.original-table-name", "cortex", "The name of the DynamoDB table used before versioned schemas were introduced.")
f.BoolVar(&cfg.UsePeriodicTables, "dynamodb.use-periodic-tables", false, "Should we use periodic tables.")

f.Var(&cfg.Tags, "dynamodb.table.tag", "Deprecated. Set tags on tables individually.")

cfg.IndexTables.RegisterFlags("dynamodb.periodic-table", "cortex_", f)
cfg.IndexTables.globalTags = &cfg.Tags
cfg.ChunkTables.RegisterFlags("dynamodb.chunk-table", "cortex_chunks_", f)
cfg.ChunkTables.globalTags = &cfg.Tags
}

func (cfg *SchemaConfig) tableForBucket(bucketStart int64) string {
Expand Down Expand Up @@ -166,10 +159,6 @@ type PeriodicTableConfig struct {
WriteScale AutoScalingConfig
InactiveWriteScale AutoScalingConfig
InactiveWriteScaleLastN int64

// Temporarily in place to support tags set on all tables, as means of
// smoothing transition to per-table tags.
globalTags *Tags
}

// RegisterFlags adds the flags required to config this to the given FlagSet.
Expand Down Expand Up @@ -223,21 +212,12 @@ func (cfg *PeriodicTableConfig) periodicTables(beginGrace, endGrace time.Duratio
result = []TableDesc{}
)
for i := firstTable; i <= lastTable; i++ {
tags := Tags(map[string]string{})
for k, v := range cfg.Tags {
tags[k] = v
}
if cfg.globalTags != nil {
for k, v := range *cfg.globalTags {
tags[k] = v
}
}
table := TableDesc{
// Name construction needs to be consistent with chunk_store.bigBuckets
Name: cfg.Prefix + strconv.Itoa(int(i)),
ProvisionedRead: cfg.InactiveReadThroughput,
ProvisionedWrite: cfg.InactiveWriteThroughput,
Tags: cfg.GetTags(),
Tags: cfg.Tags,
}

// if now is within table [start - grace, end + grace), then we need some write throughput
Expand All @@ -258,21 +238,6 @@ func (cfg *PeriodicTableConfig) periodicTables(beginGrace, endGrace time.Duratio
return result
}

// GetTags returns tags for the table. Exists to provide backwards
// compatibility for the command-line.
func (cfg *PeriodicTableConfig) GetTags() Tags {
tags := Tags(map[string]string{})
for k, v := range cfg.Tags {
tags[k] = v
}
if cfg.globalTags != nil {
for k, v := range *cfg.globalTags {
tags[k] = v
}
}
return tags
}

// TableFor calculates the table shard for a given point in time.
func (cfg *PeriodicTableConfig) TableFor(t model.Time) string {
var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/chunk/table_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (m *TableManager) calculateExpectedTables() []TableDesc {
Name: m.cfg.OriginalTableName,
ProvisionedRead: m.cfg.IndexTables.InactiveReadThroughput,
ProvisionedWrite: m.cfg.IndexTables.InactiveWriteThroughput,
Tags: m.cfg.IndexTables.GetTags(),
Tags: m.cfg.IndexTables.Tags,
}

if m.cfg.UsePeriodicTables {
Expand Down

0 comments on commit c824ad2

Please sign in to comment.