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.
  • Loading branch information
svenklemm committed Sep 18, 2024
1 parent ce58ce0 commit 460994c
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 @@ -1471,6 +1471,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 @@ -1805,8 +1806,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 @@ -1826,8 +1825,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 460994c

Please sign in to comment.