diff --git a/pkg/chunkenc/memchunk.go b/pkg/chunkenc/memchunk.go index 61fc170a25..90f82a90f4 100644 --- a/pkg/chunkenc/memchunk.go +++ b/pkg/chunkenc/memchunk.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))) diff --git a/pkg/chunkenc/memchunk_test.go b/pkg/chunkenc/memchunk_test.go index 1485b462d7..b849a4bcf3 100644 --- a/pkg/chunkenc/memchunk_test.go +++ b/pkg/chunkenc/memchunk_test.go @@ -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()