Fix erroneous value assignments

pull/5805/head
Fabian Reinartz 8 years ago
parent 8aba95048a
commit 787199a88e

@ -356,6 +356,7 @@ type chunkDesc struct {
firsTimestamp int64
lastTimestamp int64
lastValue float64
numSamples int
app chunks.Appender // Current appender for the chunks.
}
@ -374,6 +375,7 @@ func (cd *chunkDesc) append(ts int64, v float64) (err error) {
cd.lastTimestamp = ts
cd.lastValue = v
cd.numSamples++
return nil
}

@ -190,7 +190,9 @@ func (h *HeadBlock) appendBatch(samples []hashedSample) error {
newHashes []uint64
)
for _, s := range samples {
for i := range samples {
s := &samples[i]
cd, ref := h.get(s.hash, s.labels)
if cd != nil {
// TODO(fabxc): sample refs are only scoped within a block for
@ -198,8 +200,8 @@ func (h *HeadBlock) appendBatch(samples []hashedSample) error {
s.ref = ref
continue
}
s.ref = uint32(len(h.descs) + len(newSeries))
newSeries = append(newSeries, s.labels)
newHashes = append(newHashes, s.hash)
}

Loading…
Cancel
Save