Merge pull request #8359 from influxdata/jw-index-race

Fix race in SeriesN and CreateSeriesIfNotExists
pull/8344/head
Jason Wilder 2017-05-04 17:49:14 -06:00 committed by GitHub
commit 0b018caf87
1 changed files with 4 additions and 1 deletions

View File

@ -92,7 +92,10 @@ func (i *Index) SeriesSketches() (estimator.Sketch, estimator.Sketch, error) {
// Since indexes are not shared across shards, the count returned by SeriesN
// cannot be combined with other shards' counts.
func (i *Index) SeriesN() int64 {
return int64(len(i.series))
i.mu.RLock()
n := int64(len(i.series))
i.mu.RUnlock()
return n
}
// Measurement returns the measurement object from the index by the name