Skip to content

Commit

Permalink
remove some defer statements
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepsukhani committed Jun 25, 2024
1 parent d2cb08e commit b15b78c
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions pkg/compactor/retention/retention.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ func (c *chunkRewriter) rewriteChunk(ctx context.Context, ce ChunkEntry, tableIn
})
defer func() {
newChunkData.(*chunkenc.MemChunk).Reset()
newChunkData = nil
}()
if err != nil {
if errors.Is(err, chunk.ErrSliceNoDataInRange) {
Expand Down Expand Up @@ -404,9 +403,6 @@ func (c *chunkRewriter) rewriteChunk(ctx context.Context, ce ChunkEntry, tableIn
newChunkStart,
newChunkEnd,
)
defer func() {
newChunk = chunk.Chunk{}
}()

encBuf := chunkEncodeBufferPool.Get().(*bytes.Buffer)
defer func() {
Expand All @@ -425,11 +421,7 @@ func (c *chunkRewriter) rewriteChunk(ctx context.Context, ce ChunkEntry, tableIn

// upload chunk only if an entry was written
if uploadChunk {
temp := []chunk.Chunk{newChunk}
defer func() {
temp = nil
}()
err = c.chunkClient.PutChunks(ctx, temp)
err = c.chunkClient.PutChunks(ctx, []chunk.Chunk{newChunk})
if err != nil {
return false, false, err
}
Expand Down

0 comments on commit b15b78c

Please sign in to comment.