mirror of
https://github.com/prometheus/prometheus
synced 2024-12-24 07:23:02 +00:00
Fix chunkDescsTotal count in case of errors.
Only increment the counter if we actually add the memory series to the fingerprintToSeries map.
This commit is contained in:
parent
1db7589081
commit
92991026bb
@ -680,7 +680,6 @@ func (p *persistence) loadSeriesMapAndHeads() (sm *seriesMap, err error) {
|
||||
return sm, nil
|
||||
}
|
||||
chunkDescs := make([]*chunkDesc, numChunkDescs)
|
||||
chunkDescsTotal += numChunkDescs
|
||||
|
||||
for i := int64(0); i < numChunkDescs; i++ {
|
||||
if headChunkPersisted || i < numChunkDescs-1 {
|
||||
@ -715,10 +714,16 @@ func (p *persistence) loadSeriesMapAndHeads() (sm *seriesMap, err error) {
|
||||
return sm, nil
|
||||
}
|
||||
chunkDescs[i] = newChunkDesc(chunk)
|
||||
chunkDescsTotal-- // Avoid double-counting by newChunkDesc.
|
||||
}
|
||||
}
|
||||
|
||||
chunkDescsTotal += numChunkDescs
|
||||
if !headChunkPersisted {
|
||||
// In this case, we have created a chunkDesc with
|
||||
// newChunkDesc, which will count itself automatically.
|
||||
// Correct for that by decrementing the count.
|
||||
chunkDescsTotal--
|
||||
}
|
||||
fingerprintToSeries[clientmodel.Fingerprint(fp)] = &memorySeries{
|
||||
metric: clientmodel.Metric(metric),
|
||||
chunkDescs: chunkDescs,
|
||||
|
Loading…
Reference in New Issue
Block a user