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

From Hayato Kuroda (Fujitsu)
Subject RE: pgoutput: schema cache cleanup after streamed 2PC
Date
Msg-id TYRPR01MB1284520ECA8F48BA58C888569F5B82@TYRPR01MB12845.jpnprd01.prod.outlook.com
Whole thread
In response to Re: pgoutput: schema cache cleanup after streamed 2PC  (Ayush Tiwari <ayushtiwari.slg01@gmail.com>)
Responses Re: pgoutput: schema cache cleanup after streamed 2PC
List pgsql-hackers
Dear Ayush,

> You are right,  it makes sense to put it in pgoutput_stream_prepare_txn().

Thanks for the quick update. Let me dump my thought in [1] just in case.
Some tests may be needed (no need to include in core though).

> I've moved cleanup_rel_sync_cache(txn->xid, true) to
> pgoutput_stream_prepare_txn() in v2 and updated the comments.

I think the second argument should be renamed. Do you have anything in your mind?
My idea: mark_schema_sent.

[1]: 
IIUC pgoutput_commit_prepared_txn() and pgoutput_rollback_prepared_txn() are used
for both streamed and non-streamed cases. So putting the cleanup for streamed
transactions should be in pgoutput_stream_prepare_txn() as much as  possible.

The main question here is whether we pass true or false for is_commit. I think
true can be used, because no need to re-send RELATION messages once it's handled
by the subscriber side.

For streaming = on case, an apply worker firstly serialize streamed changes, then
it applies them when STREAM COMMIT or STREAM PREPARE are received. It means
RELATION messages have already handled in PREPARE phase.

For streaming = parallel case, both leader and parallel apply worker handle
RELATION messages immediately.

Best regards,
Hayato Kuroda
FUJITSU LIMITED


pgsql-hackers by date:

Previous
From: Vik Fearing
Date:
Subject: Re: ANSI SQL proposal: SELECT DISTINCT ON (... ORDER BY ...) and UNION DISTINCT ON (... ORDER BY ...)
Next
From: Robert Haas
Date:
Subject: Re: ON EMPTY clause for aggregate and window functions