On Tue, Sep 23, 2025 at 12:14 PM Bertrand Drouvot <bertranddrouvot...@gmail.com> wrote: > > Hi, > > On Fri, Sep 19, 2025 at 08:11:23PM +0530, Ashutosh Bapat wrote: > > On Fri, Sep 19, 2025 at 11:48 AM shveta malik <shveta.ma...@gmail.com> > > wrote: > > > > > 0001 is the previous patch > > 0002 changes addressing your and Bertrand's comments. > > Thanks for the new patch version! > > I did not look closely to the code yet but did some testing and I've one > remark > regarding plugin_filtered_bytes: It looks ok when a publication is doing rows > filtering but when I: > > - create a table and use pg_logical_slot_get_changes with > ('skip-empty-xacts', '0') > then I see plugin_sent_bytes increasing (which makes sense). > > - create a table and use pg_logical_slot_get_changes with > ('skip-empty-xacts', '1') > then I don't see plugin_sent_bytes increasing (which makes sense) but I also > don't > see plugin_filtered_bytes increasing. I think that would make sense to also > increase > plugin_filtered_bytes in this case (and for the other options that would skip > sending data). Thoughts?
Thanks for bringing this up. I don't think we discussed this explicitly in the thread. The changes which are filtered out by the core itself e.g. changes to the catalogs or changes to other databases or changes from undesired origins are not added to the reorder buffer. They are not counted in total_bytes. The transactions containing only such changes are not added to reorder buffer, so even total_txns does not count such empty transactions. If we count these changes and transactions in plugin_filtered_bytes, and plugin_filtered_txns, that would create an anomaly - filtered counts being higher than total counts. Further since core does not add these changes and transactions to the reorder buffer, there is no way for a plugin to know about their existence and hence count them. Does that make sense? -- Best Wishes, Ashutosh Bapat