Fix reset of a histogram chunk iterator

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
pull/11643/head
Ganesh Vernekar 2022-11-30 17:49:33 +05:30
parent 414d31aee6
commit b8b0d45d69
No known key found for this signature in database
GPG Key ID: F056451B52F1DC34
2 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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