pgoutput: schema cache cleanup after streamed 2PC

From: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Subject: pgoutput: schema cache cleanup after streamed 2PC
Date: 2026-09-17 09:03:23
Message-ID: CAJTYsWWt5aaKHCnV=jNOwABzspd-WbnhWLndDqtESDQRQ-BkKQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I think we're missing some cleanup in pgoutput for streamed 2PC.
We call cleanup_rel_sync_cache() on stream commit and abort, but not
on COMMIT PREPARED or ROLLBACK PREPARED.

For streamed transactions, maybe_send_schema() records the top-level XID
in each relation's streamed_txns list when it sends the schema. It looks
like those entries are left behind after COMMIT PREPARED or ROLLBACK
PREPARED, until the cache entry is rebuilt or the walsender exits.

The attached patch adds the same cleanup to those two callbacks, guarded
by rbtxn_is_streamed(txn). Is there a reason to keep these entries once
the prepared transaction has finished?

I tested both commit and rollback with a publisher/subscriber setup.
The data matched, and I no longer saw the cache growth with the patch.

Thoughts?

Regards,
Ayush

Attachment Content-Type Size
v1-0001-Clean-up-pgoutput-schema-cache-after-prepared-transactions.patch application/octet-stream 1.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2026-09-17 09:24:54 Re: Why clearing the VM doesn't require registering vm buffer in wal record
Previous Message Andrey Borodin 2026-09-17 08:45:37 Re: Open SSI correctness issues