Loki: Fix memchunk headblock filter (#8591)

**What this PR does / why we need it**:
Fix our memchunk headblock filter to not skip entries that have
timestamp=maxT.
pull/8594/head
Dylan Guedes 3 years ago committed by GitHub
parent f6871d8f5f
commit 030d3232ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      pkg/chunkenc/memchunk.go
  2. 2
      pkg/chunkenc/memchunk_test.go

@ -1005,7 +1005,10 @@ func (hb *headBlock) Iterator(ctx context.Context, direction logproto.Direction,
baseHash := pipeline.BaseLabels().Hash()
process := func(e entry) {
// apply time filtering
if e.t < mint || e.t >= maxt {
if e.t < mint || e.t > maxt {
return
}
if e.t == maxt && mint != maxt {
return
}
stats.AddHeadChunkBytes(int64(len(e.s)))

@ -911,8 +911,6 @@ func TestMemChunk_IteratorBounds(t *testing.T) {
t.Run(
fmt.Sprintf("mint:%d,maxt:%d,direction:%s", tt.mint.UnixNano(), tt.maxt.UnixNano(), tt.direction),
func(t *testing.T) {
t.Parallel()
tt := tt
c := createChunk()

Loading…
Cancel
Save