From: | Ajin Cherian <itsajin(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: repeated decoding of prepared transactions |
Date: | 2021-02-24 05:48:20 |
Message-ID: | CAFPTHDaHWPaDW=dYmOdtqeWXqPBhEwk_q2qbFhU7JiMCym-9Gg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Feb 23, 2021 at 8:54 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> 1. With respect to SQL APIs, currently 'two-phase-commit' is a plugin
> option so it is possible that the first time when it gets changes
> (pg_logical_slot_get_changes) *without* 2PC enabled it will not get
> the prepared even though prepare is after consistent snapshot. Now
> next time during getting changes (pg_logical_slot_get_changes) if the
> 2PC option is enabled it will skip prepare because by that time
> start_decoding_at has been moved. So the user will only get commit
> prepared as shown in the example in the email above [2]. I think it
> might be better to allow enable/disable of 2PC only at create_slot
> time. Markus, Ajin, and I seem to be in agreement on this point. I
> think the same will be true for subscriber-side solution as well.
>
Attaching a patch which avoids repeated decoding of prepares using the
approach suggest by Andres. Added snapshot_was_exported_at_lsn;
fields in ReplicationSlotPersistentData and SnapBuild which now stores
the LSN at which the slot snapshot is exported the time it is created.
This patch also modifies the API pg_create_logical_replication_slot()
to take an extra parameter to enable two-phase commits
and disables pg_logical_slot_get_changes() from enabling two-phase.
I plan to split this into two patches next. But do review and let me
know if you have any comments.
regards,
Ajin
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Avoid-repeated-decoding-of-prepared-transactions.patch | application/octet-stream | 53.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | wangsh.fnst@fujitsu.com | 2021-02-24 05:53:13 | RE: Refactor ECPGconnect and allow IPv6 connection |
Previous Message | Amit Kapila | 2021-02-24 04:11:51 | Re: Parallel INSERT (INTO ... SELECT ...) |