Thread

  1. Re: Report bytes and transactions actually sent downtream

    Bertrand Drouvot <bertranddrouvot.pg@gmail.com> — 2025-12-17T08:42:15Z

    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