Andrew Dunstan <[email protected]> wrote: > > On 2026-11-20 Fr 7:00 PM, Zsolt Parragi wrote: > > + * TABLEAM_SUPPORTS_LOGICAL_DECODING: every change to the relation's rows > > can > > + * be logically decoded, which needs the AM's resource manager to have an > > + * rm_decode callback. REPACK (CONCURRENTLY) checks this, as it would > > + * otherwise lose the changes made while it runs. > > > > Doesn't it also require filtering (change_useless_for_repack)? > > > Yes, it does, and the comment should have said so. pgrepack's change > callback asserts that it only sees changes to the relation being rebuilt > ("Changes of other relation should not have been decoded"), so an AM whose > rm_decode doesn't call change_useless_for_repack() would trip that on an > assert build, and on a non-assert build feed other tables' changes into the > rewrite. Our AM's rm_decode already does it for each kind of change, which > is how I missed that the contract didn't mention it. I have added it to the > comment on the flag and to tableam.sgml.
When we were working on REPACK (CONCURRENTLY), Alvaro pointed out that the filtering might fit better into the plugin. We haven't done it in v19, but the mention of change_useless_for_repack() in your patch reminds me that the function call really does not fit perfectly into rm_decode() - the problem is that rm_decode() is also called during logical replication, which does not need the filtering. Attached is a patch that adds a new filtering callback to the output plugin. If it's what Alvaro meant, then I wonder if it makes sense to merge it first. (In any case, I added a TODO comment referencing this thread, so that your documentation and comments are updated if your patch lands in the tree first.) -- Antonin Houska Web: https://www.cybertec-postgresql.com
0001-Introduce-an-output-plugin-callback-to-filter-change.patch.nocfbot
Description: application/mbox
