Performance optimization suggestions

pull/9885/head
chenjian.cj 2018-05-14 16:27:09 +08:00 committed by Stuart Carnie
parent ff070313ed
commit f82d53f75d
1 changed files with 6 additions and 4 deletions

View File

@ -1066,11 +1066,13 @@ func (i *Index) assignExistingSeries(shardID uint64, seriesIDSet *tsdb.SeriesIDS
} else {
// Add the existing series to this shard's bitset, since this may
// be the first time the series is added to this shard.
seriesIDSet.Lock()
if !seriesIDSet.ContainsNoLock(ss.ID) {
seriesIDSet.AddNoLock(ss.ID)
if !seriesIDSet.Contains(ss.ID) {
seriesIDSet.Lock()
if !seriesIDSet.ContainsNoLock(ss.ID) {
seriesIDSet.AddNoLock(ss.ID)
}
seriesIDSet.Unlock()
}
seriesIDSet.Unlock()
}
}
i.mu.RUnlock()