diff --git a/CHANGELOG.md b/CHANGELOG.md index 47e9e73f58..d99e7e7715 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ - [#6720](https://github.com/influxdata/influxdb/issues/6720): Concurrent map read write panic. Thanks @arussellsaw - [#6727](https://github.com/influxdata/influxdb/issues/6727): queries with strings that look like dates end up with date types, not string types - [#6250](https://github.com/influxdata/influxdb/issues/6250): Slow startup time +- [#6753](https://github.com/influxdata/influxdb/issues/6753): Prevent panic if there are no values. ## v0.13.0 [2016-05-12] diff --git a/tsdb/engine/tsm1/file_store.gen.go b/tsdb/engine/tsm1/file_store.gen.go index 82959dc655..e93073ab1c 100644 --- a/tsdb/engine/tsm1/file_store.gen.go +++ b/tsdb/engine/tsm1/file_store.gen.go @@ -25,6 +25,11 @@ func (c *KeyCursor) ReadFloatBlock(tdec *TimeDecoder, vdec *FloatDecoder, buf *[ tombstones := first.r.TombstoneRange(c.key) values = c.filterFloatValues(tombstones, values) + // Check we have remaining values. + if len(values) == 0 { + return nil, nil + } + // Only one block with this key and time range so return it if len(c.current) == 1 { if len(values) > 0 { @@ -155,6 +160,11 @@ func (c *KeyCursor) ReadIntegerBlock(tdec *TimeDecoder, vdec *IntegerDecoder, bu tombstones := first.r.TombstoneRange(c.key) values = c.filterIntegerValues(tombstones, values) + // Check we have remaining values. + if len(values) == 0 { + return nil, nil + } + // Only one block with this key and time range so return it if len(c.current) == 1 { if len(values) > 0 { @@ -285,6 +295,11 @@ func (c *KeyCursor) ReadStringBlock(tdec *TimeDecoder, vdec *StringDecoder, buf tombstones := first.r.TombstoneRange(c.key) values = c.filterStringValues(tombstones, values) + // Check we have remaining values. + if len(values) == 0 { + return nil, nil + } + // Only one block with this key and time range so return it if len(c.current) == 1 { if len(values) > 0 { @@ -415,6 +430,11 @@ func (c *KeyCursor) ReadBooleanBlock(tdec *TimeDecoder, vdec *BooleanDecoder, bu tombstones := first.r.TombstoneRange(c.key) values = c.filterBooleanValues(tombstones, values) + // Check we have remaining values. + if len(values) == 0 { + return nil, nil + } + // Only one block with this key and time range so return it if len(c.current) == 1 { if len(values) > 0 { diff --git a/tsdb/engine/tsm1/file_store.gen.go.tmpl b/tsdb/engine/tsm1/file_store.gen.go.tmpl index ed48044bd5..9e929ec038 100644 --- a/tsdb/engine/tsm1/file_store.gen.go.tmpl +++ b/tsdb/engine/tsm1/file_store.gen.go.tmpl @@ -20,6 +20,11 @@ func (c *KeyCursor) Read{{.Name}}Block(tdec *TimeDecoder, vdec *{{.Name}}Decoder tombstones := first.r.TombstoneRange(c.key) values = c.filter{{.Name}}Values(tombstones, values) + // Check we have remaining values. + if len(values) == 0 { + return nil, nil + } + // Only one block with this key and time range so return it if len(c.current) == 1 { if len(values) > 0 {