mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 06:04:05 -08:00
storage: Added checks for invariants
This commit is contained in:
parent
31e9db7f0c
commit
75282b27ba
|
@ -706,6 +706,9 @@ func (p *persistence) checkpointSeriesMapAndHeads(fingerprintToSeries *seriesMap
|
|||
}
|
||||
}
|
||||
// chunkDescsOffset.
|
||||
if m.series.chunkDescsOffset < 0 && m.series.persistWatermark > 0 {
|
||||
panic("encountered unknown chunk desc offset in combination with positive persist watermark")
|
||||
}
|
||||
if _, err = codable.EncodeVarint(w, int64(m.series.chunkDescsOffset+m.series.persistWatermark)); err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -283,6 +283,9 @@ func (s *memorySeries) evictChunkDescs(lenToEvict int) {
|
|||
if lenToEvict < 1 {
|
||||
return
|
||||
}
|
||||
if s.chunkDescsOffset < 0 {
|
||||
panic("chunk desc eviction requested with unknown chunk desc offset")
|
||||
}
|
||||
lenToKeep := len(s.chunkDescs) - lenToEvict
|
||||
s.savedFirstTime = s.firstTime()
|
||||
s.chunkDescsOffset += lenToEvict
|
||||
|
|
Loading…
Reference in a new issue