pgoutput: schema cache cleanup after streamed 2PC - Mailing list pgsql-hackers

From Ayush Tiwari
Subject pgoutput: schema cache cleanup after streamed 2PC
Date
Msg-id CAJTYsWWt5aaKHCnV=jNOwABzspd-WbnhWLndDqtESDQRQ-BkKQ@mail.gmail.com
Whole thread
Responses RE: pgoutput: schema cache cleanup after streamed 2PC
List 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

pgsql-hackers by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: Open SSI correctness issues
Next
From: Andrey Borodin
Date:
Subject: Re: Why clearing the VM doesn't require registering vm buffer in wal record