Re: Report bytes and transactions actually sent downtream

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, shveta malik <shveta(dot)malik(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-12-17 08:42:15
Message-ID: aUJs5w787EjKlBfv@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Dec 11, 2025 at 10:29:42AM +0530, Ashutosh Bapat wrote:
> Sorry for the delayed response. PFA the patch implementing the idea
> discussed above. It relies on the output plugin callback to return
> correct boolean but maintains the statistics in the core itself.

Thanks for the new patch version!

What worries me is all those API changes:

-typedef void (*LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx,
+typedef bool (*LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx,

Those changes will break existing third party logical decoding plugin, even ones
that don't want the new statistics features.

What about not changing those and just add a single new optional callback, say?

typedef void (*LogicalDecodeReportStatsCB)(
LogicalDecodingContext *ctx,
ReorderBufferTXN *txn,
bool *transaction_sent,
size_t *bytes_filtered
);

This way:

- Existing plugins can still work without modification
- New or existing plugins can choose to provide statistics

Thoughts?

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou (Fujitsu) 2025-12-17 08:48:33 RE: Proposal: Cascade REPLICA IDENTITY changes to leaf partitions
Previous Message Anthonin Bonnefoy 2025-12-17 08:40:28 Re: Fix possible 'unexpected data beyond EOF' on replica restart