pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Alexey Kondratov <a.kondratov@postgrespro.ru>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Andrey V. Lepikhov <a.lepikhov@postgrespro.ru>
Cc: tsunakawa.takay@fujitsu.com, movead.li@highgo.ca, 'Amit Kapila' <amit.kapila16@gmail.com>
Cc: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
Cc: PostgreSQL-Dev <pgsql-hackers@postgresql.org>
Subject: Re: Global snapshots
Date: Tue, 08 Sep 2020 13:36:16 +0300
Message-ID: <0e51d0298eed7588664e3c67a4fb15c9@postgrespro.ru> (raw )
In-Reply-To: <057004b6-68bf-98ee-7c57-91c418f6e221@oss.nttdata.com >
References: <07b2c899-4ed0-4c87-1327-23c750311248@postgrespro.ru >
<9964cf46-9294-34b9-4858-971e9029f5c7@postgrespro.ru >
<CAA4eK1Jo=1261+qEKmm69Bm9wv6fvR7kVbqDo7EFUw3vkQtC7w@mail.gmail.com >
<f23083b9-38d0-6126-eb6e-091816a78585@postgrespro.ru >
<CAA4eK1K8ibXN8vknTYvjz1sd+JaDDohvV9jBxSs+=1=KJz=u=w@mail.gmail.com >
<CA+fd4k6oZtO-MFYmunHVecGaTWre8YKDNTSfX9hZhQh6Kui1kA@mail.gmail.com >
<CAA4eK1JVsMWUD4q-b+vawehFzJb6Qg0AOGq7qOGL_gm6EEhdJg@mail.gmail.com >
<CA+fd4k6HE8xLGEvqWzABEg8kkju5MxU+if7bf-md0_2pjzXp9Q@mail.gmail.com >
<CAA4eK1+tMDXU9WtQ0kRgyk1jPr+K-7FowMdFB8=t-ptUEQa-mQ@mail.gmail.com >
<CA+fd4k6YTa25VxpsqvpvqZmsCErT5T8=MYNNDXt7Wn0DsJvSrg@mail.gmail.com >
<CAA4eK1KAB=YbvDd3a8g2qNj2QNrQANnrpNmoaNCtEMLfaiFjrg@mail.gmail.com >
<TYAPR01MB2990E83F9E886A9C8AB8E269FE760@TYAPR01MB2990.jpnprd01.prod.outlook.com >
<TYAPR01MB29902D8B671A5A6946F5AEA8FE720@TYAPR01MB2990.jpnprd01.prod.outlook.com >
<806c3708-26ea-b94d-87b1-d48e41e93726@postgrespro.ru >
<3ef7877bfed0582019eab3d462a43275@postgrespro.ru >
<057004b6-68bf-98ee-7c57-91c418f6e221@oss.nttdata.com >
On 2020-09-08 05:49, Fujii Masao wrote:
> On 2020/09/05 3:31, Alexey Kondratov wrote:
>>
>> Attached is a patch, which implements a plain 2PC in the postgres_fdw
>> and adds a GUC 'postgres_fdw.use_twophase'. Also it solves these
>> errors handling issues above and tries to add proper comments
>> everywhere. I think, that 0003 should be rebased on the top of it, or
>> it could be a first patch in the set, since it may be used
>> independently. What do you think?
>
> Thanks for the patch!
>
> Sawada-san was proposing another 2PC patch at [1]. Do you have any
> thoughts
> about pros and cons between your patch and Sawada-san's?
>
> [1]
> https://www.postgresql.org/message-id/CA+fd4k4z6_B1ETEvQamwQhu4RX7XsrN5ORL7OhJ4B5B6sW-RgQ@mail.gmail...
Thank you for the link!
After a quick look on the Sawada-san's patch set I think that there are
two major differences:
1. There is a built-in foreign xacts resolver in the [1], which should
be much more convenient from the end-user perspective. It involves huge
in-core changes and additional complexity that is of course worth of.
However, it's still not clear for me that it is possible to resolve all
foreign prepared xacts on the Postgres' own side with a 100% guarantee.
Imagine a situation when the coordinator node is actually a HA cluster
group (primary + sync + async replica) and it failed just after PREPARE
stage of after local COMMIT. In that case all foreign xacts will be left
in the prepared state. After failover process complete synchronous
replica will become a new primary. Would it have all required info to
properly resolve orphan prepared xacts?
Probably, this situation is handled properly in the [1], but I've not
yet finished a thorough reading of the patch set, though it has a great
doc!
On the other hand, previous 0003 and my proposed patch rely on either
manual resolution of hung prepared xacts or usage of external
monitor/resolver. This approach is much simpler from the in-core
perspective, but doesn't look as complete as [1] though.
2. In the patch from this thread all 2PC logic sit in the postgres_fdw,
while [1] tries to put it into the generic fdw core, which also feels
like a more general and architecturally correct way. However, how many
from the currently available dozens of various FDWs are capable to
perform 2PC? And how many of them are maintained well enough to adopt
this new API? This is not an argument against [1] actually, since
postgres_fdw is known to be the most advanced FDW and an early adopter
of new feature, just a little doubt about a usefulness of this
preliminary generalisation.
Anyway, I think that [1] is a great work and really hope to find more
time to investigate it deeper later this year.
Regards
--
Alexey Kondratov
Postgres Professional https://www.postgrespro.com
Russian Postgres Company
view thread (6+ messages) latest in thread
Message-ID: <0e51d0298eed7588664e3c67a4fb15c9@postgrespro.ru>
Permalink: ../0e51d0298eed7588664e3c67a4fb15c9@postgrespro.ru/
Also on: postgresql.org/message-id/0e51d0298eed7588664e3c67a4fb15c9@postgrespro.ru
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: a.kondratov@postgrespro.ru, masao.fujii@oss.nttdata.com, a.lepikhov@postgrespro.ru, amit.kapila16@gmail.com, masahiko.sawada@2ndquadrant.com
Subject: Re: Global snapshots
In-Reply-To: <0e51d0298eed7588664e3c67a4fb15c9@postgrespro.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox