Fix query engine not goroutine safe issue.

pull/3749/head
Paul Dix 2015-08-19 18:43:50 -04:00
parent 47533465a7
commit 1c24cbd8a7
2 changed files with 12 additions and 1 deletions

View File

@ -216,7 +216,7 @@ func (lm *LocalMapper) Open() error {
// No data exists for this key.
continue
}
seriesTags := lm.shard.index.series[key].Tags
seriesTags := lm.shard.index.TagsForSeries(key)
cm := newSeriesCursor(c, t.Filters[i], seriesTags)
cursors = append(cursors, cm)
}

View File

@ -112,6 +112,17 @@ func (s *DatabaseIndex) CreateMeasurementIndexIfNotExists(name string) *Measurem
return m
}
// TagsForSeries returns the tag map for the passed in series
func (s *DatabaseIndex) TagsForSeries(key string) map[string]string {
s.mu.RLock()
defer s.mu.RUnlock()
ss := s.series[key]
if ss == nil {
return nil
}
return ss.Tags
}
// measurementsByExpr takes and expression containing only tags and returns
// a list of matching *Measurement.
func (db *DatabaseIndex) measurementsByExpr(expr influxql.Expr) (Measurements, error) {