Fix tag dereferencing panic.

Clones series tags under lock during var ref iterator creation.
pull/8011/head
Ben Johnson 2017-02-15 16:01:17 -07:00
parent 0e0057d1da
commit 8e79ca5d75
No known key found for this signature in database
GPG Key ID: CBD06EAD6DFD9529
2 changed files with 9 additions and 1 deletions

View File

@ -13,6 +13,7 @@
- [#7905](https://github.com/influxdata/influxdb/issues/7905): Fix ORDER BY time DESC with ordering series keys.
- [#7966](https://github.com/influxdata/influxdb/pull/7966): Prevent a panic when aggregates are used in an inner query with a raw query.
- [#8001](https://github.com/influxdata/influxdb/issues/8001): Map types correctly when using a regex and one of the measurements is empty.
- [#8011](https://github.com/influxdata/influxdb/issues/8011): Fix tag dereferencing panic.
## v1.2.0 [2017-01-24]

View File

@ -272,7 +272,7 @@ func (d *DatabaseIndex) TagsForSeries(key string) models.Tags {
if ss == nil {
return nil
}
return ss.Tags
return ss.CloneTags()
}
// MeasurementsByExpr takes an expression containing only tags and returns a
@ -1629,6 +1629,13 @@ func (s *Series) ForEachTag(fn func(models.Tag)) {
}
}
// CloneTags returns a copy of the series tags under lock.
func (s *Series) CloneTags() models.Tags {
s.mu.RLock()
defer s.mu.RUnlock()
return s.Tags.Clone()
}
// Dereference removes references to a byte slice.
func (s *Series) Dereference(b []byte) {
s.mu.Lock()