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

From: Ajin Cherian <itsajin(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(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: 2020-12-08 08:31:15
Message-ID: CAFPTHDYA8yE6tEmQ2USYS68kNt+kM=SwKgj=jy4AvFD5e9-UTQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 1, 2020 at 6:26 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:

> To skip it, we need to send GID in begin message and then on
> subscriber-side, check if the prepared xact already exists, if so then
> set a flag. The flag needs to be set in begin/start_stream and reset
> in stop_stream/commit/abort. Using the flag, we can skip the entire
> contents of the prepared xact. In ReorderFuffer-side also, we need to
> get and set GID in txn even when we skip it because we need to send
> the same at commit time. In this solution, we won't be able to send it
> during normal start_stream because by that time we won't know GID and
> I think that won't be required. Note that this is only required when
> we skipped sending prepare, otherwise, we just need to send
> Commit-Prepared at commit time.

I have implemented these changes and tested the fix using the test
setup I had shared above and it seems to be working fine.
I have also tested restarts that simulate duplicate prepares being
sent by the publisher and verified that it is handled correctly by the
subscriber.
Do have a look at the changes and let me know if you have any comments.

regards,
Ajin Cherian
Fujitsu Australia

Attachment Content-Type Size
v30-0003-Support-2PC-txn-tests-for-test_decoding.patch application/octet-stream 30.2 KB
v30-0005-Support-2PC-txn-spoolfile.patch application/octet-stream 3.4 KB
v30-0004-Support-2PC-txn-tests-for-concurrent-aborts.patch application/octet-stream 16.6 KB
v30-0001-Extend-the-output-plugin-API-to-allow-decoding-p.patch application/octet-stream 41.0 KB
v30-0002-Allow-decoding-at-prepare-time-in-ReorderBuffer.patch application/octet-stream 37.4 KB
v30-0006-Support-2PC-txn-pgoutput.patch application/octet-stream 28.2 KB
v30-0008-Support-2PC-documentation.patch application/octet-stream 5.8 KB
v30-0009-Support-2PC-txn-Subscription-option.patch application/octet-stream 35.2 KB
v30-0007-Support-2PC-txn-subscriber-tests.patch application/octet-stream 60.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2020-12-08 08:42:12 Re: PoC Refactor AM analyse API
Previous Message Hamid Akhtar 2020-12-08 08:17:25 Re: {CREATE INDEX, REINDEX} CONCURRENTLY improvements