Re: [HACKERS] logical decoding of two-phase transactions

From: Ajin Cherian <itsajin(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: Greg Nancarrow <gregn4422(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] logical decoding of two-phase transactions
Date: 2021-06-17 14:09:50
Message-ID: CAFPTHDZ6J+KLMq6yWnvDbsdoJu-9mrkjzSUx69yqKimDskCE5A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 16, 2021 at 9:08 AM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> On Fri, Jun 11, 2021 at 6:34 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> > KNOWN ISSUES: This v85 patch was built and tested using yesterday's
> > master, but due to lots of recent activity in the replication area I
> > expect it will be broken for HEAD very soon (if not already). I'll
> > rebase it again ASAP to try to keep it in working order.
> >
>
> Please find attached the latest patch set v86*

I've modified the patchset based on comments received on thread [1]
for the CREATE_REPLICATION_SLOT
changes. Based on the request from that thread, I've taken out those
changes as two new patches (patch-1 and patch-2)
and made this into 5 patches. I've also changed the logic to align
with the changes in the command syntax.

I've also addressed one pending comment from Amit about
CreateInitDecodingContext, I've taken out the logic that
sets slot->data.two_phase, and only kept the logic that sets ctx->twophase.

Before:

- ctx->twophase &= MyReplicationSlot->data.two_phase;
+ ctx->twophase &= (ctx->twophase_opt_given || slot->data.two_phase);
+
+ /* Mark slot to allow two_phase decoding if not already marked */
+ if (ctx->twophase && !slot->data.two_phase)
+ {
+ slot->data.two_phase = true;
+ ReplicationSlotMarkDirty();
+ ReplicationSlotSave();
+ }

After:

- ctx->twophase &= MyReplicationSlot->data.two_phase;
+ ctx->twophase &= slot->data.two_phase;

[1] - https://postgr.es/m/64b9f783c6e125f18f88fbc0c0234e34e71d8639.camel@j-davis.com

regards,
Ajin Cherian
Fujitsu Australia

Attachment Content-Type Size
v87-0001-Add-option-to-set-two-phase-in-CREATE_REPLICATIO.patch application/octet-stream 6.5 KB
v87-0003-Add-support-for-prepared-transactions-to-built-i.patch application/octet-stream 146.4 KB
v87-0004-Add-prepare-API-support-for-streaming-transactio.patch application/octet-stream 54.0 KB
v87-0005-Skip-empty-transactions-for-logical-replication.patch application/octet-stream 27.5 KB
v87-0002-Add-support-for-two-phase-decoding-in-pg_recvlog.patch application/octet-stream 11.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2021-06-17 14:36:08 Re: pgbench logging broken by time logic changes
Previous Message Amit Kapila 2021-06-17 13:40:44 Re: Fix for segfault in logical replication on master