mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
Fix erroneous value assignments
This commit is contained in:
parent
8aba95048a
commit
787199a88e
2
db.go
2
db.go
|
@ -356,6 +356,7 @@ type chunkDesc struct {
|
||||||
firsTimestamp int64
|
firsTimestamp int64
|
||||||
lastTimestamp int64
|
lastTimestamp int64
|
||||||
lastValue float64
|
lastValue float64
|
||||||
|
numSamples int
|
||||||
|
|
||||||
app chunks.Appender // Current appender for the chunks.
|
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.lastTimestamp = ts
|
||||||
cd.lastValue = v
|
cd.lastValue = v
|
||||||
|
cd.numSamples++
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
6
head.go
6
head.go
|
@ -190,7 +190,9 @@ func (h *HeadBlock) appendBatch(samples []hashedSample) error {
|
||||||
newHashes []uint64
|
newHashes []uint64
|
||||||
)
|
)
|
||||||
|
|
||||||
for _, s := range samples {
|
for i := range samples {
|
||||||
|
s := &samples[i]
|
||||||
|
|
||||||
cd, ref := h.get(s.hash, s.labels)
|
cd, ref := h.get(s.hash, s.labels)
|
||||||
if cd != nil {
|
if cd != nil {
|
||||||
// TODO(fabxc): sample refs are only scoped within a block for
|
// 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
|
s.ref = ref
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
s.ref = uint32(len(h.descs) + len(newSeries))
|
s.ref = uint32(len(h.descs) + len(newSeries))
|
||||||
|
|
||||||
newSeries = append(newSeries, s.labels)
|
newSeries = append(newSeries, s.labels)
|
||||||
newHashes = append(newHashes, s.hash)
|
newHashes = append(newHashes, s.hash)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue