From db445844d3d0521ed352a2a830b281329ba0f34e Mon Sep 17 00:00:00 2001 From: kevinForMyself <60905914+kevinForMyself@users.noreply.github.com> Date: Fri, 22 Jan 2021 23:03:10 +0800 Subject: [PATCH] Fix garbage collection about t.droppedSeries in QueueManager.SeriesReset. (#8387) * Fix memory leak about t.droppedSeries in QueueManager.SeriesReset. Signed-off-by: kevinForMyself * Fix garbage collection about t.droppedSeries in QueueManager.SeriesReset Signed-off-by: kevinForMyself --- storage/remote/queue_manager.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storage/remote/queue_manager.go b/storage/remote/queue_manager.go index 66d2e67b9..5d3d5a4ea 100644 --- a/storage/remote/queue_manager.go +++ b/storage/remote/queue_manager.go @@ -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