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 15, 2024
1 parent 2c3ff7a commit 5dce312
Showing 1 changed file with 1 addition and 4 deletions.
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 5dce312

Please sign in to comment.