Re: Logical Replication vs. 2PC - Mailing list pgsql-hackers

From Markus Wanner
Subject Re: Logical Replication vs. 2PC
Date
Msg-id 17fbfbe4-b86a-b8f4-2ad1-f6819168f2e8@enterprisedb.com
Whole thread Raw
In response to Re: Logical Replication vs. 2PC  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: Logical Replication vs. 2PC  (Amit Kapila <amit.kapila16@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Log message for GSS connection is missing once connection authorization is successful.
Next
From: Tomas Vondra
Date:
Subject: Re: [HACKERS] Custom compression methods