Fix race in shard

engine was accessed outside of an RLock which can cause a race when
montitoring goroutines access the shard while it's closed/closing.
pull/8370/head
Jason Wilder 2017-05-08 12:37:18 -06:00
parent ef6b0e214b
commit 041262af0e
1 changed files with 4 additions and 0 deletions

View File

@ -958,10 +958,14 @@ func (s *Shard) CreateSnapshot() (string, error) {
}
func (s *Shard) ForEachMeasurementTagKey(name []byte, fn func(key []byte) error) error {
s.mu.RLock()
defer s.mu.RUnlock()
return s.engine.ForEachMeasurementTagKey(name, fn)
}
func (s *Shard) TagKeyCardinality(name, key []byte) int {
s.mu.RLock()
defer s.mu.RUnlock()
return s.engine.TagKeyCardinality(name, key)
}