Re: Report bytes and transactions actually sent downtream

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: shveta malik <shveta.malik@gmail.com>, Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, Ashutosh Sharma <ashu.coek88@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-11-03T15:20:57Z
Lists: pgsql-hackers
Hi,

On 2025-11-03 19:53:30 +0530, Ashutosh Bapat wrote:
> This commit adds following fields to pg_stat_replication_slots
> - plugin_filtered_bytes is the amount of changes filtered out by the
>   output plugin
> - plugin_sent_txns is the amount of transactions sent downstream by the
>   output plugin
> - plugin_sent_bytes is the amount of data sent downstream by the output
>   plugin.
> 
> The prefix "plugin_" indicates that these counters are related to and
> maintained by the output plugin. An output plugin may choose not to
> initialize LogicalDecodingContext::stats, which holds these counters, in
> which case the above columns will be reported as NULL.

I continue to be uncomfortable with doing all this tracking explicitly in
output plugins. This still seems like something core infrastructure should
take care of, instead of re-implementing it in different output plugins, with
the inevitable behaviour differences that will entail.

Greetings,

Andres Freund