Skip to content

Commit

Permalink
Improve headchunk efficiency.
Browse files Browse the repository at this point in the history
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
  • Loading branch information
cyriltovena committed Jan 24, 2020
1 parent f6d9978 commit 1db3138
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/chunkenc/memchunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,13 +511,11 @@ func (hb *headBlock) iterator(ctx context.Context, mint, maxt int64, filter logq
// the alternate would be that we allocate a new b.entries everytime we cut a block,
// but the tradeoff is that queries to near-realtime data would be much lower than
// cutting of blocks.

chunkStats.LinesUncompressed += int64(len(hb.entries))
entries := make([]entry, 0, len(hb.entries))
for _, e := range hb.entries {
line := []byte(e.s)
chunkStats.BytesUncompressed += int64(len(line))
chunkStats.LinesUncompressed++
if filter == nil || filter(line) {
chunkStats.BytesUncompressed += int64(len(e.s))
if filter == nil || filter([]byte(e.s)) {
entries = append(entries, e)
}
}
Expand Down

0 comments on commit 1db3138

Please sign in to comment.