Merge pull request #6663 from influxdata/js-6659-panic-on-show-field-keys
Fixing panic in SHOW FIELD KEYS caused by 733a17d
pull/6667/head
commit
32fdb022ad
|
@ -13,7 +13,6 @@
|
|||
- [#6519](https://github.com/influxdata/influxdb/issues/6519): Support cast syntax for selecting a specific type.
|
||||
- [#6654](https://github.com/influxdata/influxdb/pull/6654): Add new HTTP statistics to monitoring
|
||||
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- [#6604](https://github.com/influxdata/influxdb/pull/6604): Remove old cluster code
|
||||
|
@ -24,7 +23,7 @@
|
|||
- [#6644](https://github.com/influxdata/influxdb/issues/6644): Print the query executor's stack trace on a panic to the log.
|
||||
- [#6650](https://github.com/influxdata/influxdb/issues/6650): Data race when dropping a database immediately after writing to it
|
||||
- [#6235](https://github.com/influxdata/influxdb/issues/6235): Fix measurement field panic in tsm1 engine.
|
||||
|
||||
- [#6663](https://github.com/influxdata/influxdb/issues/6663): Fixing panic in SHOW FIELD KEYS.
|
||||
|
||||
## v0.13.0 [2016-05-12]
|
||||
|
||||
|
|
|
@ -486,13 +486,10 @@ func (s *Shard) FieldDimensions(sources influxql.Sources) (fields map[string]inf
|
|||
}
|
||||
|
||||
// Append fields and dimensions.
|
||||
fieldNames := mm.FieldNames()
|
||||
if len(fieldNames) > 0 {
|
||||
mf := s.engine.MeasurementFields(m.Name)
|
||||
for _, name := range fieldNames {
|
||||
if f := mf.Field(name); f != nil {
|
||||
fields[name] = f.Type
|
||||
}
|
||||
if mf != nil {
|
||||
for name, typ := range mf.FieldSet() {
|
||||
fields[name] = typ
|
||||
}
|
||||
}
|
||||
for _, key := range mm.TagKeys() {
|
||||
|
@ -997,7 +994,7 @@ type fieldKeysIterator struct {
|
|||
mms Measurements // remaining measurements
|
||||
buf struct {
|
||||
mm *Measurement // current measurement
|
||||
fields []*Field // current measurement's fields
|
||||
fields []Field // current measurement's fields
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1017,15 +1014,23 @@ func (itr *fieldKeysIterator) Next() (*influxql.FloatPoint, error) {
|
|||
}
|
||||
|
||||
itr.buf.mm = itr.mms[0]
|
||||
keys := itr.buf.mm.FieldNames()
|
||||
if len(keys) > 0 {
|
||||
// Sort the keys in alphabetical order.
|
||||
sort.Strings(keys)
|
||||
// Retrieve the field for each key.
|
||||
mf := itr.sh.engine.MeasurementFields(itr.buf.mm.Name)
|
||||
itr.buf.fields = make([]*Field, len(keys))
|
||||
if mf != nil {
|
||||
fset := mf.FieldSet()
|
||||
if len(fset) == 0 {
|
||||
itr.mms = itr.mms[1:]
|
||||
continue
|
||||
}
|
||||
|
||||
keys := make([]string, 0, len(fset))
|
||||
for k := range fset {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
|
||||
itr.buf.fields = make([]Field, len(keys))
|
||||
for i, name := range keys {
|
||||
itr.buf.fields[i] = mf.Field(name)
|
||||
itr.buf.fields[i] = Field{Name: name, Type: fset[name]}
|
||||
}
|
||||
}
|
||||
itr.mms = itr.mms[1:]
|
||||
|
|
Loading…
Reference in New Issue