Skip to content

Commit

Permalink
Add logs in the recompression code path
Browse files Browse the repository at this point in the history
We added a few diagnostic log messages in the compression/decompression
code paths some time ago and they have been useful in identifying
hotspots in the actual activities. Adding a few more for recompression
now. The row_compressor_append_sorted_rows function which is also used
in recompression is already logged so we need just a few log messages
here.
  • Loading branch information
nikkhils committed Jun 28, 2024
1 parent 60c9f4d commit 6e01b8c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tsl/src/compression/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1088,9 +1088,17 @@ recompress_chunk_segmentwise_impl(Chunk *uncompressed_chunk)
* on the updated tuple in the CHUNK table potentially preventing other transaction
* from updating it
*/
ts_chunk_clear_status(uncompressed_chunk,
CHUNK_STATUS_COMPRESSED_UNORDERED | CHUNK_STATUS_COMPRESSED_PARTIAL);
if (ts_chunk_clear_status(uncompressed_chunk,
CHUNK_STATUS_COMPRESSED_UNORDERED | CHUNK_STATUS_COMPRESSED_PARTIAL))
ereport(LOG,
(errmsg("cleared chunk status for recompression: \"%s.%s\"",
NameStr(uncompressed_chunk->fd.schema_name),
NameStr(uncompressed_chunk->fd.table_name))));

ereport(LOG,
(errmsg("acquiring locks for recompression: \"%s.%s\"",
NameStr(uncompressed_chunk->fd.schema_name),
NameStr(uncompressed_chunk->fd.table_name))));
/* lock both chunks, compressed and uncompressed */
/* TODO: Take RowExclusive locks instead of AccessExclusive */
Relation uncompressed_chunk_rel = table_open(uncompressed_chunk->table_id, ExclusiveLock);
Expand Down Expand Up @@ -1190,6 +1198,10 @@ recompress_chunk_segmentwise_impl(Chunk *uncompressed_chunk)

/* Index scan */
Relation index_rel = index_open(row_compressor.index_oid, ExclusiveLock);
ereport(LOG,
(errmsg("locks acquired for recompression: \"%s.%s\"",
NameStr(uncompressed_chunk->fd.schema_name),
NameStr(uncompressed_chunk->fd.table_name))));

index_scan = index_beginscan(compressed_chunk_rel, index_rel, snapshot, 0, 0);
TupleTableSlot *slot = table_slot_create(compressed_chunk_rel, NULL);
Expand Down

0 comments on commit 6e01b8c

Please sign in to comment.