On Tue, Mar 17, 2026 at 10:32 AM Amit Kapila <[email protected]> wrote:
>
> On Tue, Mar 17, 2026 at 4:51 AM Michael Paquier <[email protected]> wrote:
> >
> > The trick with this patch is to make sure that all the relevant places
> > where data is sent downstream are correctly incremented.
> >
>
> Right.
>
> >  As far as I
> > can see, things seem to be covered, but I cannot help but wonder if we
> > are missing one or more places.  @Amit, do you feel a hole somewhere?
> >
>
> Yesterday, I raised a point related to this which is whether we want
> to count messages like keep_alive, copy_done, or
> PqReplMsg_PrimaryStatusUpdate? These don't contain the user decoded
> data from WAL but some additional information between
> publisher-subscriber required to ensure data is being applied.

I think sent_bytes should count the logically decoded data - the data
that the output plugin produces in logical form. This is the amount of
data that the downstream has to process for data replication. So, the
protocol related data shouldn't be counted here, IMO. Compare this
with the total_bytes which does not account for the memory used by the
reorder buffer metadata itself - it just accounts for the size of the
changes. If we describe the sent_bytes as below, we are explicitly
mentioning what sent_bytes is. So anything which is not data in the
output format is excluded including the protocol data. If you think we
need to clarify that we are excluding protocol data, we can add a
line. But that may confuse readers who are unaware of the protocol
data.

Amount of transaction changes sent downstream in the output plugin
format for this slot. The output plugin may filter the changes it
receives. Hence the amount of data that it converts to the output
plugin format is less than the <structfield>total_bytes</structfield>.
But the format of data before and after the conversion is different.
Hence the value of <structfield>sent_bytes</structfield> is not
directly related to the value of
<structfield>total_bytes</structfield>.

The phrase "transaction changes" is being debated in a separate
sub-thread, I will reply there.

-- 
Best Wishes,
Ashutosh Bapat


Reply via email to