Re: Report bytes and transactions actually sent downtream

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Report bytes and transactions actually sent downtream
Date: 2025-11-18 10:44:12
Message-ID: CAA4eK1Kf38Q84Mi9oGsBNJHKdqNaipNwy_h6R2PKJx6GfR1xEg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 18, 2025 at 4:05 PM Ashutosh Bapat
<ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
>
> On Tue, Nov 18, 2025 at 3:24 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Tue, Nov 4, 2025 at 4:29 PM Ashutosh Bapat
> > <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
> > >
> > > a. sentTxns and filteredBytes need to be modified in the output plugin
> > > code. The behaviour there is inherently output plugin specific, and
> > > requires output plugin specific implementation.
> > >
> >
> > Is it possible that we allow change callback (LogicalDecodeChangeCB)
> > to return a boolean such that if the change is decoded and sent, it
> > returns true, otherwise, false? If so, the caller could deduce from it
> > the filtered bytes, and if none of the change calls returns true, this
> > means the entire transaction is not sent.
> >
> > I think this should address Andres's concern of explicitly tracking
> > these stats in plugins, what do you think?
> >
>
> I was thinking about a similar thing. But I am skeptical since the
> calling logic is not straight forward - there's an indirection in
> between. Second, it means that all the plugins have to adapt to the
> new callback definition. It is optional in my current approach. Since
> both of us have thought of this approach, I think it's worth a try.
>
> "if none of the change calls returns true, this means the entire
> transaction is not sent" isn't true. A plugin may still send an empty
> transaction. I was thinking of making commit/abort/prepare callbacks
> to return true/false to indicate whether a transaction was sent or not
> and increment the counter accordingly. The plugin has to take care of
> not returning true for both prepare and commit or prepare and abort.
> So may be just commit and abort should be made to return true or
> false. What do you think?
>

Sounds reasonable to me.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2025-11-18 11:00:17 RE: Parallel Apply
Previous Message Shlok Kyal 2025-11-18 10:36:53 Re: How can end users know the cause of LR slot sync delays?