From 8c0b9747bf5c98d87e138768c6391c29bd864366 Mon Sep 17 00:00:00 2001 From: Vladyslav Diachenko Date: Fri, 4 Aug 2023 13:19:49 +0300 Subject: [PATCH] switched the new memchunks to `DefaultHeadBlockFmt` when we rebound the data Signed-off-by: Vladyslav Diachenko --- pkg/chunkenc/memchunk.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pkg/chunkenc/memchunk.go b/pkg/chunkenc/memchunk.go index c6f5de4a13afc..90d8ef8d32091 100644 --- a/pkg/chunkenc/memchunk.go +++ b/pkg/chunkenc/memchunk.go @@ -1091,24 +1091,16 @@ func (c *MemChunk) Rebound(start, end time.Time, filter filter.Func) (Chunk, err return nil, err } - // If the head format is not explicitly set, use the default. - // This will be the most common case for chunks read from storage since - // they have a dummy head block. - headFmt := c.headFmt - if headFmt < OrderedHeadBlockFmt { - headFmt = DefaultHeadBlockFmt - } - var newChunk *MemChunk // as close as possible, respect the block/target sizes specified. However, // if the blockSize is not set, use reasonable defaults. if c.blockSize > 0 { - newChunk = NewMemChunk(c.Encoding(), headFmt, c.blockSize, c.targetSize) + newChunk = NewMemChunk(c.Encoding(), DefaultHeadBlockFmt, c.blockSize, c.targetSize) } else { // Using defaultBlockSize for target block size. // The alternative here could be going over all the blocks and using the size of the largest block as target block size but I(Sandeep) feel that it is not worth the complexity. // For target chunk size I am using compressed size of original chunk since the newChunk should anyways be lower in size than that. - newChunk = NewMemChunk(c.Encoding(), headFmt, defaultBlockSize, c.CompressedSize()) + newChunk = NewMemChunk(c.Encoding(), DefaultHeadBlockFmt, defaultBlockSize, c.CompressedSize()) } for itr.Next() {