Skip to content

Commit

Permalink
Reuse chunk metas
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
  • Loading branch information
fpetkovski committed Nov 5, 2022
1 parent 8dca74b commit 31874e2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ type blockSeriesClient struct {
// Internal state.
i int
postings []storage.SeriesRef
chkMetas []chunks.Meta
symbolizedLset []symbolizedLabel
entries []seriesEntry
batch []*storepb.SeriesResponse
Expand Down Expand Up @@ -941,8 +942,7 @@ func (b *blockSeriesClient) nextBatch() error {
}

for i := 0; i < len(postingsBatch); i++ {
var chks []chunks.Meta
ok, err := b.indexr.LoadSeriesForTime(postingsBatch[i], &b.symbolizedLset, &chks, b.skipChunks, b.mint, b.maxt)
ok, err := b.indexr.LoadSeriesForTime(postingsBatch[i], &b.symbolizedLset, &b.chkMetas, b.skipChunks, b.mint, b.maxt)
if err != nil {
return errors.Wrap(err, "read series")
}
Expand Down Expand Up @@ -970,10 +970,10 @@ func (b *blockSeriesClient) nextBatch() error {
s := seriesEntry{}
// Schedule loading chunks.
s.lset = completeLabelset
s.refs = make([]chunks.ChunkRef, 0, len(chks))
s.chks = make([]storepb.AggrChunk, 0, len(chks))
s.refs = make([]chunks.ChunkRef, 0, len(b.chkMetas))
s.chks = make([]storepb.AggrChunk, 0, len(b.chkMetas))

for j, meta := range chks {
for j, meta := range b.chkMetas {
if err := b.chunkr.addLoad(meta.Ref, len(b.entries), j); err != nil {
return errors.Wrap(err, "add chunk load")
}
Expand All @@ -985,7 +985,7 @@ func (b *blockSeriesClient) nextBatch() error {
}

// Ensure sample limit through chunksLimiter if we return chunks.
if err := b.chunksLimiter.Reserve(uint64(len(chks))); err != nil {
if err := b.chunksLimiter.Reserve(uint64(len(b.chkMetas))); err != nil {
return errors.Wrap(err, "exceeded chunks limit")
}

Expand Down

0 comments on commit 31874e2

Please sign in to comment.