Browse Source

Merge pull request #13427 from bboreham/skip-empty-merge

storage: skip merging when no remote storage configured
pull/13442/head
Bryan Boreham 10 months ago committed by GitHub
parent
commit
0fe7ba97c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      storage/fanout.go
  2. 3
      storage/merge.go

4
storage/fanout.go

@ -89,7 +89,9 @@ func (f *fanout) Querier(mint, maxt int64) (Querier, error) {
}
return nil, errs.Err()
}
secondaries = append(secondaries, querier)
if _, ok := querier.(noopQuerier); !ok {
secondaries = append(secondaries, querier)
}
}
return NewMergeQuerier([]Querier{primary}, secondaries, ChainedSeriesMerge), nil
}

3
storage/merge.go

@ -46,6 +46,9 @@ type mergeGenericQuerier struct {
//
// In case of overlaps between the data given by primaries' and secondaries' Selects, merge function will be used.
func NewMergeQuerier(primaries, secondaries []Querier, mergeFn VerticalSeriesMergeFunc) Querier {
if len(primaries)+len(secondaries) == 0 {
return NoopQuerier()
}
queriers := make([]genericQuerier, 0, len(primaries)+len(secondaries))
for _, q := range primaries {
if _, ok := q.(noopQuerier); !ok && q != nil {

Loading…
Cancel
Save