From 33b959b898f509f957fedbe3a60228b124a7efbb Mon Sep 17 00:00:00 2001 From: Bjoern Rabenstein Date: Sat, 8 Nov 2014 01:01:34 +0100 Subject: [PATCH] Persist savedFirstTime in checkpoint. Change-Id: Ibdfdea16fad0608ec104fbccc749e824a171f227 --- storage/local/persistence.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/storage/local/persistence.go b/storage/local/persistence.go index 525a2b729..fba1fdc36 100644 --- a/storage/local/persistence.go +++ b/storage/local/persistence.go @@ -841,6 +841,9 @@ func (p *persistence) checkpointSeriesMapAndHeads(fingerprintToSeries *seriesMap if _, err = codable.EncodeVarint(w, int64(m.series.chunkDescsOffset)); err != nil { 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 { return } @@ -973,6 +976,12 @@ func (p *persistence) loadSeriesMapAndHeads() (sm *seriesMap, err error) { p.dirty = true 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) if err != nil { 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), chunkDescs: chunkDescs, chunkDescsOffset: int(chunkDescsOffset), + savedFirstTime: clientmodel.Timestamp(savedFirstTime), headChunkPersisted: headChunkPersisted, } }