federation: nil pointer deference when using remove read

```
level=error ts=2018-06-13T07:19:04.515149169Z caller=stdlib.go:89 component=web caller="http: panic serving [::1" msg="]:56202: runtime error: invalid memory address or nil pointer dereference"
level=error ts=2018-06-13T07:19:04.516199547Z caller=stdlib.go:89 component=web caller="http: panic serving [::1" msg="]:56204: runtime error: invalid memory address or nil pointer dereference"
level=error ts=2018-06-13T07:19:04.51717692Z caller=stdlib.go:89 component=web caller="http: panic serving [::1" msg="]:56206: runtime error: invalid memory address or nil pointer dereference"
level=error ts=2018-06-13T07:19:04.564952878Z caller=stdlib.go:89 component=web caller="http: panic serving [::1" msg="]:56208: runtime error: invalid memory address or nil pointer dereference"
level=error ts=2018-06-13T07:19:04.566575791Z caller=stdlib.go:89 component=web caller="http: panic serving [::1" msg="]:56210: runtime error: invalid memory address or nil pointer dereference"
level=error ts=2018-06-13T07:19:04.567106063Z caller=stdlib.go:89 component=web caller="http: panic serving [::1" msg="]:56212: runtime error: invalid memory address or nil pointer dereference"
```

When remove read is enabled, federation will call `q.Select(nil, mset...)`
which will break remote reads because it currently doesn't handle empty
SelectParams.

Signed-off-by: Corentin Chary <c.chary@criteo.com>
pull/4284/head
Corentin Chary 7 years ago committed by Brian Brazil
parent dacb6c530a
commit db9dbeeaec

@ -91,10 +91,13 @@ func ToQuery(from, to int64, matchers []*labels.Matcher, p *storage.SelectParams
if err != nil { if err != nil {
return nil, err return nil, err
} }
var rp *prompb.ReadHints = nil
rp := &prompb.ReadHints{ if p != nil {
StepMs: p.Step, rp = &prompb.ReadHints{
Func: p.Func, StepMs: p.Step,
Func: p.Func,
}
} }
return &prompb.Query{ return &prompb.Query{

Loading…
Cancel
Save