From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Ajin Cherian <itsajin(at)gmail(dot)com> |
Cc: | Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [HACKERS] logical decoding of two-phase transactions |
Date: | 2021-03-19 14:35:08 |
Message-ID: | CAA4eK1JLz7ypPdbkPjHQW5c9vOZO5onOwb+fSLsArHQjg6dNhQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Mar 19, 2021 at 5:03 AM Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
>
> Missed the patch - 0001, resending.
>
I have made miscellaneous changes in the patch which includes
improving comments, error messages, and miscellaneous coding
improvements. The most notable one is that we don't need an additional
parameter in walrcv_startstreaming, if the two_phase option is set
properly. My changes are in v63-0002-Misc-changes-by-Amit, if you are
fine with those, then please merge them in the next version. I have
omitted the dev-logs patch but feel free to submit it. I have one
question:
@@ -538,10 +550,21 @@ CreateDecodingContext(XLogRecPtr start_lsn,
..
+ /* Set two_phase_at LSN only if it hasn't already been set. */
+ if (ctx->twophase && !MyReplicationSlot->data.two_phase_at)
+ {
+ MyReplicationSlot->data.two_phase_at = start_lsn;
+ slot->data.two_phase = true;
+ ReplicationSlotMarkDirty();
+ ReplicationSlotSave();
+ SnapBuildSetTwoPhaseAt(ctx->snapshot_builder, start_lsn);
+ }
What if the walsender or apply worker restarts after setting
two_phase_at/two_phase here and updating the two_phase state in
pg_subscription? Won't we need to set SnapBuildSetTwoPhaseAt after
restart as well? If so, we probably need a else if (ctx->twophase)
{Assert (slot->data.two_phase_at);
SnapBuildSetTwoPhaseAt(ctx->snapshot_builder,
slot->data.two_phase_at);}. Am, I missing something?
--
With Regards,
Amit Kapila.
Attachment | Content-Type | Size |
---|---|---|
v63-0001-Add-support-for-apply-at-prepare-time-to-built-i.patch | application/octet-stream | 102.1 KB |
v63-0002-Misc-changes-by-Amit.patch | application/octet-stream | 15.7 KB |
v63-0003-Support-2PC-txn-subscriber-tests.patch | application/octet-stream | 24.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Julien Rouhaud | 2021-03-19 14:35:21 | Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view? |
Previous Message | Julien Rouhaud | 2021-03-19 14:27:51 | Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view? |