Re: Decoding of two-phase xacts missing from CREATE_REPLICATION_SLOT command
Ajin Cherian <itsajin@gmail.com>
From: Ajin Cherian <itsajin@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Jeff Davis <pgsql@j-davis.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>, Amit Kapila <akapila@postgresql.org>, vignesh C <vignesh21@gmail.com>, Peter Smith <smithpb2250@gmail.com>
Date: 2021-06-15T07:34:21Z
Lists: pgsql-hackers
Attachments
- v5-0001-Add-option-to-set-two-phase-in-CREATE_REPLICATION.patch (application/octet-stream) patch v5-0001
- v5-0002-Add-support-for-two-phase-decoding-in-pg_recvlogi.patch (application/octet-stream) patch v5-0002
On Fri, Jun 11, 2021 at 8:14 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> Also, I can take care of the below cosmetic issues before committing
> if we decide to do this for PG-14.
>
> Few cosmetic issues:
> ==================
> 1. git diff --check shows
> src/bin/pg_basebackup/t/030_pg_recvlogical.pl:109: new blank line at EOF.
>
> 2.
> +
> <para>
> The following example shows SQL interface that can be used to decode prepared
> transactions. Before you use two-phase commit commands, you must set
>
> Spurious line addition.
>
Fixed.
> 3.
> /* Build query */
> appendPQExpBuffer(query, "CREATE_REPLICATION_SLOT \"%s\"", slot_name);
> if (is_temporary)
> appendPQExpBufferStr(query, " TEMPORARY");
> +
> if (is_physical)
>
> Spurious line addition.
>
Fixed.
> 4.
> appendPQExpBuffer(query, " LOGICAL \"%s\"", plugin);
> + if (two_phase && PQserverVersion(conn) >= 140000)
> + appendPQExpBufferStr(query, " TWO_PHASE");
> +
> if (PQserverVersion(conn) >= 100000)
> /* pg_recvlogical doesn't use an exported snapshot, so suppress */
> appendPQExpBufferStr(query, " NOEXPORT_SNAPSHOT");
>
> I think it might be better to append TWO_PHASE after NOEXPORT_SNAPSHOT
> but it doesn't matter much.
>
I haven't changed this, I like to keep it this way.
> 5.
> +$node->safe_psql('postgres',
> + "BEGIN;INSERT INTO test_table values (11); PREPARE TRANSACTION 'test'");
>
> There is no space after BEGIN but there is a space after INSERT. For
> consistency-sake, I will have space after BEGIN as well.
Changed this.
regards,
Ajin Cherian
Fujitsu Australia
Commits
-
Remove two_phase variable from CreateReplicationSlotCmd struct.
- be57f21650d3 14.0 landed
-
Add option to enable two_phase commits via pg_create_logical_replication_slot.
- 19890a064ebf 14.0 cited