mirror of
https://github.com/prometheus/prometheus
synced 2025-04-11 03:52:13 +00:00
Fix expunging of empty memory series (loop var pointerization bug)
This commit is contained in:
parent
1bd8ee15f3
commit
e7f049c85b
@ -227,7 +227,7 @@ func (s *memorySeriesStorage) getOrCreateSeries(metric clientmodel.Metric, finge
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *memorySeriesStorage) Flush(flushOlderThan time.Time, queue chan<- clientmodel.Samples) {
|
func (s *memorySeriesStorage) Flush(flushOlderThan time.Time, queue chan<- clientmodel.Samples) {
|
||||||
emptySeries := clientmodel.Fingerprints{}
|
emptySeries := []clientmodel.Fingerprint{}
|
||||||
|
|
||||||
s.RLock()
|
s.RLock()
|
||||||
for fingerprint, stream := range s.fingerprintToSeries {
|
for fingerprint, stream := range s.fingerprintToSeries {
|
||||||
@ -258,7 +258,7 @@ func (s *memorySeriesStorage) Flush(flushOlderThan time.Time, queue chan<- clien
|
|||||||
stream.values = toKeep
|
stream.values = toKeep
|
||||||
|
|
||||||
if len(toKeep) == 0 {
|
if len(toKeep) == 0 {
|
||||||
emptySeries = append(emptySeries, &fingerprint)
|
emptySeries = append(emptySeries, fingerprint)
|
||||||
}
|
}
|
||||||
stream.Unlock()
|
stream.Unlock()
|
||||||
}
|
}
|
||||||
@ -266,8 +266,8 @@ func (s *memorySeriesStorage) Flush(flushOlderThan time.Time, queue chan<- clien
|
|||||||
|
|
||||||
s.Lock()
|
s.Lock()
|
||||||
for _, fingerprint := range emptySeries {
|
for _, fingerprint := range emptySeries {
|
||||||
if s.fingerprintToSeries[*fingerprint].empty() {
|
if s.fingerprintToSeries[fingerprint].empty() {
|
||||||
s.dropSeries(fingerprint)
|
s.dropSeries(&fingerprint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.Unlock()
|
s.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user