Persist savedFirstTime in checkpoint.

Change-Id: Ibdfdea16fad0608ec104fbccc749e824a171f227
This commit is contained in:
Bjoern Rabenstein 2014-11-08 01:01:34 +01:00
parent 904acd43da
commit 33b959b898

View file

@ -841,6 +841,9 @@ func (p *persistence) checkpointSeriesMapAndHeads(fingerprintToSeries *seriesMap
if _, err = codable.EncodeVarint(w, int64(m.series.chunkDescsOffset)); err != nil { if _, err = codable.EncodeVarint(w, int64(m.series.chunkDescsOffset)); err != nil {
return return
} }
if _, err = codable.EncodeVarint(w, int64(m.series.savedFirstTime)); err != nil {
return
}
if _, err = codable.EncodeVarint(w, int64(len(m.series.chunkDescs))); err != nil { if _, err = codable.EncodeVarint(w, int64(len(m.series.chunkDescs))); err != nil {
return return
} }
@ -973,6 +976,12 @@ func (p *persistence) loadSeriesMapAndHeads() (sm *seriesMap, err error) {
p.dirty = true p.dirty = true
return sm, nil return sm, nil
} }
savedFirstTime, err := binary.ReadVarint(r)
if err != nil {
glog.Warning("Could not decode saved first time:", err)
p.dirty = true
return sm, nil
}
numChunkDescs, err := binary.ReadVarint(r) numChunkDescs, err := binary.ReadVarint(r)
if err != nil { if err != nil {
glog.Warning("Could not decode number of chunk descriptors:", err) glog.Warning("Could not decode number of chunk descriptors:", err)
@ -1023,6 +1032,7 @@ func (p *persistence) loadSeriesMapAndHeads() (sm *seriesMap, err error) {
metric: clientmodel.Metric(metric), metric: clientmodel.Metric(metric),
chunkDescs: chunkDescs, chunkDescs: chunkDescs,
chunkDescsOffset: int(chunkDescsOffset), chunkDescsOffset: int(chunkDescsOffset),
savedFirstTime: clientmodel.Timestamp(savedFirstTime),
headChunkPersisted: headChunkPersisted, headChunkPersisted: headChunkPersisted,
} }
} }