Merge pull request #5623 from influxdata/jw-query-panic

Fix panic: runtime error: index out of range
pull/5170/head
Ben Johnson 2016-02-10 14:59:04 -07:00
commit 0b3d367e5c
2 changed files with 5 additions and 22 deletions

View File

@ -1,5 +1,8 @@
// Generated by tmpl
// https://github.com/benbjohnson/tmpl
//
// DO NOT EDIT!
// Source: iterator.gen.go.tmpl
package tsm1
@ -240,7 +243,6 @@ func (c *floatAscendingCursor) peekCache() (t int64, v float64) {
// peekTSM returns the current time/value from tsm.
func (c *floatAscendingCursor) peekTSM() (t int64, v float64) {
if c.tsm.pos < 0 || c.tsm.pos >= len(c.tsm.values) {
c.tsm.keyCursor.Close()
return tsdb.EOF, math.NaN()
}
@ -294,7 +296,6 @@ func (c *floatAscendingCursor) nextTSM() {
c.tsm.keyCursor.Next()
c.tsm.values, _ = c.tsm.keyCursor.ReadFloatBlock(c.tsm.buf)
if len(c.tsm.values) == 0 {
c.tsm.keyCursor.Close()
return
}
c.tsm.pos = 0
@ -352,7 +353,6 @@ func (c *floatDescendingCursor) peekCache() (t int64, v float64) {
// peekTSM returns the current time/value from tsm.
func (c *floatDescendingCursor) peekTSM() (t int64, v float64) {
if c.tsm.pos < 0 || c.tsm.pos >= len(c.tsm.values) {
c.tsm.keyCursor.Close()
return tsdb.EOF, math.NaN()
}
@ -406,7 +406,6 @@ func (c *floatDescendingCursor) nextTSM() {
c.tsm.keyCursor.Next()
c.tsm.values, _ = c.tsm.keyCursor.ReadFloatBlock(c.tsm.buf)
if len(c.tsm.values) == 0 {
c.tsm.keyCursor.Close()
return
}
c.tsm.pos = 0
@ -576,7 +575,6 @@ func (c *integerAscendingCursor) peekCache() (t int64, v int64) {
// peekTSM returns the current time/value from tsm.
func (c *integerAscendingCursor) peekTSM() (t int64, v int64) {
if c.tsm.pos < 0 || c.tsm.pos >= len(c.tsm.values) {
c.tsm.keyCursor.Close()
return tsdb.EOF, 0
}
@ -630,7 +628,6 @@ func (c *integerAscendingCursor) nextTSM() {
c.tsm.keyCursor.Next()
c.tsm.values, _ = c.tsm.keyCursor.ReadIntegerBlock(c.tsm.buf)
if len(c.tsm.values) == 0 {
c.tsm.keyCursor.Close()
return
}
c.tsm.pos = 0
@ -688,7 +685,6 @@ func (c *integerDescendingCursor) peekCache() (t int64, v int64) {
// peekTSM returns the current time/value from tsm.
func (c *integerDescendingCursor) peekTSM() (t int64, v int64) {
if c.tsm.pos < 0 || c.tsm.pos >= len(c.tsm.values) {
c.tsm.keyCursor.Close()
return tsdb.EOF, 0
}
@ -742,7 +738,6 @@ func (c *integerDescendingCursor) nextTSM() {
c.tsm.keyCursor.Next()
c.tsm.values, _ = c.tsm.keyCursor.ReadIntegerBlock(c.tsm.buf)
if len(c.tsm.values) == 0 {
c.tsm.keyCursor.Close()
return
}
c.tsm.pos = 0
@ -912,7 +907,6 @@ func (c *stringAscendingCursor) peekCache() (t int64, v string) {
// peekTSM returns the current time/value from tsm.
func (c *stringAscendingCursor) peekTSM() (t int64, v string) {
if c.tsm.pos < 0 || c.tsm.pos >= len(c.tsm.values) {
c.tsm.keyCursor.Close()
return tsdb.EOF, ""
}
@ -966,7 +960,6 @@ func (c *stringAscendingCursor) nextTSM() {
c.tsm.keyCursor.Next()
c.tsm.values, _ = c.tsm.keyCursor.ReadStringBlock(c.tsm.buf)
if len(c.tsm.values) == 0 {
c.tsm.keyCursor.Close()
return
}
c.tsm.pos = 0
@ -1024,7 +1017,6 @@ func (c *stringDescendingCursor) peekCache() (t int64, v string) {
// peekTSM returns the current time/value from tsm.
func (c *stringDescendingCursor) peekTSM() (t int64, v string) {
if c.tsm.pos < 0 || c.tsm.pos >= len(c.tsm.values) {
c.tsm.keyCursor.Close()
return tsdb.EOF, ""
}
@ -1078,7 +1070,6 @@ func (c *stringDescendingCursor) nextTSM() {
c.tsm.keyCursor.Next()
c.tsm.values, _ = c.tsm.keyCursor.ReadStringBlock(c.tsm.buf)
if len(c.tsm.values) == 0 {
c.tsm.keyCursor.Close()
return
}
c.tsm.pos = 0
@ -1248,7 +1239,6 @@ func (c *booleanAscendingCursor) peekCache() (t int64, v bool) {
// peekTSM returns the current time/value from tsm.
func (c *booleanAscendingCursor) peekTSM() (t int64, v bool) {
if c.tsm.pos < 0 || c.tsm.pos >= len(c.tsm.values) {
c.tsm.keyCursor.Close()
return tsdb.EOF, false
}
@ -1302,7 +1292,6 @@ func (c *booleanAscendingCursor) nextTSM() {
c.tsm.keyCursor.Next()
c.tsm.values, _ = c.tsm.keyCursor.ReadBooleanBlock(c.tsm.buf)
if len(c.tsm.values) == 0 {
c.tsm.keyCursor.Close()
return
}
c.tsm.pos = 0
@ -1360,7 +1349,6 @@ func (c *booleanDescendingCursor) peekCache() (t int64, v bool) {
// peekTSM returns the current time/value from tsm.
func (c *booleanDescendingCursor) peekTSM() (t int64, v bool) {
if c.tsm.pos < 0 || c.tsm.pos >= len(c.tsm.values) {
c.tsm.keyCursor.Close()
return tsdb.EOF, false
}
@ -1414,7 +1402,6 @@ func (c *booleanDescendingCursor) nextTSM() {
c.tsm.keyCursor.Next()
c.tsm.values, _ = c.tsm.keyCursor.ReadBooleanBlock(c.tsm.buf)
if len(c.tsm.values) == 0 {
c.tsm.keyCursor.Close()
return
}
c.tsm.pos = 0

View File

@ -4,7 +4,7 @@ import (
"sort"
"fmt"
"math"
"github.com/influxdata/influxdb/influxql"
"github.com/influxdata/influxdb/tsdb"
)
@ -72,7 +72,7 @@ func (c *bufCursor) nextAt(seek int64) interface{} {
} else if k < seek {
continue
}
c.unread(k, v)
// Return "nil" value for type.
@ -239,7 +239,6 @@ func (c *{{.name}}AscendingCursor) peekCache() (t int64, v {{.Type}}) {
// peekTSM returns the current time/value from tsm.
func (c *{{.name}}AscendingCursor) peekTSM() (t int64, v {{.Type}}) {
if c.tsm.pos < 0 || c.tsm.pos >= len(c.tsm.values) {
c.tsm.keyCursor.Close()
return tsdb.EOF, {{.Nil}}
}
@ -293,7 +292,6 @@ func (c *{{.name}}AscendingCursor) nextTSM() {
c.tsm.keyCursor.Next()
c.tsm.values, _ = c.tsm.keyCursor.Read{{.Name}}Block(c.tsm.buf)
if len(c.tsm.values) == 0 {
c.tsm.keyCursor.Close()
return
}
c.tsm.pos = 0
@ -351,7 +349,6 @@ func (c *{{.name}}DescendingCursor) peekCache() (t int64, v {{.Type}}) {
// peekTSM returns the current time/value from tsm.
func (c *{{.name}}DescendingCursor) peekTSM() (t int64, v {{.Type}}) {
if c.tsm.pos < 0 || c.tsm.pos >= len(c.tsm.values) {
c.tsm.keyCursor.Close()
return tsdb.EOF, {{.Nil}}
}
@ -405,7 +402,6 @@ func (c *{{.name}}DescendingCursor) nextTSM() {
c.tsm.keyCursor.Next()
c.tsm.values, _ = c.tsm.keyCursor.Read{{.Name}}Block(c.tsm.buf)
if len(c.tsm.values) == 0 {
c.tsm.keyCursor.Close()
return
}
c.tsm.pos = 0