diff --git a/head.go b/head.go index 0a67400e0c..30ab05b291 100644 --- a/head.go +++ b/head.go @@ -1364,7 +1364,6 @@ type memSeries struct { firstChunkID int nextAt int64 // Timestamp at which to cut the next chunk. - lastValue float64 sampleBuf [4]sample pendingCommit bool // Whether there are samples waiting to be committed to this series. @@ -1432,7 +1431,7 @@ func (s *memSeries) appendable(t int64, v float64) error { } // We are allowing exact duplicates as we can encounter them in valid cases // like federation and erroring out at that time would be extremely noisy. - if math.Float64bits(s.lastValue) != math.Float64bits(v) { + if math.Float64bits(s.sampleBuf[3].v) != math.Float64bits(v) { return ErrAmendSample } return nil @@ -1504,8 +1503,6 @@ func (s *memSeries) append(t int64, v float64) (success, chunkCreated bool) { c.maxTime = t - s.lastValue = v - s.sampleBuf[0] = s.sampleBuf[1] s.sampleBuf[1] = s.sampleBuf[2] s.sampleBuf[2] = s.sampleBuf[3]