Re: Logical Replication vs. 2PC

From: Markus Wanner <markus(dot)wanner(at)enterprisedb(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ajin Cherian <itsajin(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, osumi(dot)takamichi(at)fujitsu(dot)com
Subject: Re: Logical Replication vs. 2PC
Date: 2021-03-20 09:27:21
Message-ID: 17fbfbe4-b86a-b8f4-2ad1-f6819168f2e8@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20.03.21 03:17, Amit Kapila wrote:
> Are you saying that users might use the same GID which we have
> constructed internally (say by combining origin and xid: originid_xid)
> and then there will be conflict while replaying such transactions?

No, I was pondering about a user doing (in short sequence):

..
PREPARE TRANSACTION 'foobar';
COMMIT PREPARED 'foobar';

BEGIN;
...
PREPARE TRANSACTION 'foobar';
COMMIT PREPARED 'foobar';

> Right and even for one subscription that can lead to blocking
> transactions. But isn't it similar to what we get for a primary key
> violation while replaying transactions?

Sure, it's a conflict that prevents application. A primary key conflict
may be different in that it does not eventually resolve, though.

> In that case, we suggest users
> remove conflicting rows, so in such cases, we can recommend users to
> commit/rollback such prepared xacts?

Right, if you use gids, you could ask the user to always provide unique
identifiers and not reuse them on any other node. That's putting the
burden of coming up with unique identifiers on the user, but that's a
perfectly fine and reasonable thing to do. (Lots of other systems out
there requiring a unique request id or such, which would get confused if
you issue requests with duplicate ids.)

Regards

Markus

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-03-20 09:35:26 Re: [HACKERS] Custom compression methods
Previous Message Michael Paquier 2021-03-20 08:37:47 Re: Log message for GSS connection is missing once connection authorization is successful.