Fix garbage collection about t.droppedSeries in QueueManager.SeriesReset. (#8387)

* Fix memory leak about t.droppedSeries in QueueManager.SeriesReset.

Signed-off-by: kevinForMyself <zise_2001@163.com>

* Fix garbage collection about t.droppedSeries in QueueManager.SeriesReset

Signed-off-by: kevinForMyself <zise_2001@163.com>
This commit is contained in:
kevinForMyself 2021-01-22 23:03:10 +08:00 committed by GitHub
parent a7e446cf2d
commit db445844d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -538,13 +538,15 @@ func (t *QueueManager) StoreSeries(series []record.RefSeries, index int) {
t.seriesMtx.Lock()
defer t.seriesMtx.Unlock()
for _, s := range series {
// Just make sure all the Refs of Series will insert into seriesSegmentIndexes map for tracking.
t.seriesSegmentIndexes[s.Ref] = index
ls := processExternalLabels(s.Labels, t.externalLabels)
lbls := relabel.Process(ls, t.relabelConfigs...)
if len(lbls) == 0 {
t.droppedSeries[s.Ref] = struct{}{}
continue
}
t.seriesSegmentIndexes[s.Ref] = index
t.internLabels(lbls)
// We should not ever be replacing a series labels in the map, but just