mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Merge pull request #11643 from codesome/histochunkreset
Fix reset of a histogram chunk iterator
This commit is contained in:
commit
0e4cbd0f4c
|
@ -624,9 +624,9 @@ func (it *histogramIterator) Err() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (it *histogramIterator) Reset(b []byte) {
|
func (it *histogramIterator) Reset(b []byte) {
|
||||||
// The first 2 bytes contain chunk headers.
|
// The first 3 bytes contain chunk headers.
|
||||||
// We skip that for actual samples.
|
// We skip that for actual samples.
|
||||||
it.br = newBReader(b[2:])
|
it.br = newBReader(b[3:])
|
||||||
it.numTotal = binary.BigEndian.Uint16(b)
|
it.numTotal = binary.BigEndian.Uint16(b)
|
||||||
it.numRead = 0
|
it.numRead = 0
|
||||||
|
|
||||||
|
|
|
@ -84,14 +84,14 @@ func TestHistogramChunkSameBuckets(t *testing.T) {
|
||||||
require.Equal(t, exp, act)
|
require.Equal(t, exp, act)
|
||||||
|
|
||||||
// 2. Expand second iterator while reusing first one.
|
// 2. Expand second iterator while reusing first one.
|
||||||
// it2 := c.Iterator(it1)
|
it2 := c.Iterator(it)
|
||||||
// var res2 []pair
|
var res2 []res
|
||||||
// for it2.Next() {
|
for it2.Next() == ValHistogram {
|
||||||
// ts, v := it2.At()
|
ts, h := it2.AtHistogram()
|
||||||
// res2 = append(res2, pair{t: ts, v: v})
|
res2 = append(res2, res{t: ts, h: h})
|
||||||
// }
|
}
|
||||||
// require.NoError(t, it2.Err())
|
require.NoError(t, it2.Err())
|
||||||
// require.Equal(t, exp, res2)
|
require.Equal(t, exp, res2)
|
||||||
|
|
||||||
// 3. Test iterator Seek.
|
// 3. Test iterator Seek.
|
||||||
// mid := len(exp) / 2
|
// mid := len(exp) / 2
|
||||||
|
|
Loading…
Reference in a new issue