Skip to content

Commit

Permalink
Reset per compressed row memory context during tuple filtering
Browse files Browse the repository at this point in the history
When a batch was skipped due to compression tuple filtering the
per compressed row memory context would not be reset leading to
memory usage increasing linearly with number of consecutive filtered
batches.

(cherry picked from commit 460994c)
  • Loading branch information
svenklemm authored and timescale-automation committed Sep 18, 2024
1 parent b9a1a9b commit bd6354e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions .unreleased/pr_7270
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes: #7270 Fix memory leak in compressed DML batch filtering
5 changes: 1 addition & 4 deletions tsl/src/compression/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,7 @@ build_decompressor(Relation in_rel, Relation out_rel)
void
row_decompressor_reset(RowDecompressor *decompressor)
{
MemoryContextReset(decompressor->per_compressed_row_ctx);
decompressor->unprocessed_tuples = 0;
decompressor->batches_decompressed = 0;
decompressor->tuples_decompressed = 0;
Expand Down Expand Up @@ -1791,8 +1792,6 @@ row_decompressor_decompress_row_to_table(RowDecompressor *decompressor)
}

MemoryContextSwitchTo(old_ctx);
MemoryContextReset(decompressor->per_compressed_row_ctx);

row_decompressor_reset(decompressor);

return n_batch_rows;
Expand All @@ -1812,8 +1811,6 @@ row_decompressor_decompress_row_to_tuplesort(RowDecompressor *decompressor,
}

MemoryContextSwitchTo(old_ctx);
MemoryContextReset(decompressor->per_compressed_row_ctx);

row_decompressor_reset(decompressor);
}

Expand Down

0 comments on commit bd6354e

Please sign in to comment.