From: Markus Wanner <markus.wanner@enterprisedb.com>
To: Andres Freund <andres@anarazel.de>
Cc: Ajin Cherian <itsajin@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: robertmhaas@gmail.com
Cc: simon.riggs@enterprisedb.com
Cc: petr.jelinek@enterprisedb.com
Subject: Re: repeated decoding of prepared transactions
Date: Mon, 22 Feb 2021 09:25:52 +0100
Message-ID: <a73fa714-b0ff-54f5-f915-d4f13d210789@enterprisedb.com> (raw)
In-Reply-To: <20210222042243.2tnmt4ozz2rnohfw@alap3.anarazel.de>
References: <d0f60d60-133d-bf8d-bd70-47784d8fabf3@enterprisedb.com>
<CAA4eK1L5aX1BL9Xg-wSULbFeB417G0v9qk5qZ6NbYCkCo6JUGQ@mail.gmail.com>
<CAA4eK1JLVfB9hiczRyTt6qLmw90qR3-9ZzeZnHi-52nEw5_SYg@mail.gmail.com>
<CAFPTHDbbth0XVwf=WXcmp=_2nU5oNaK4CxetUr22qi1UM5v6rw@mail.gmail.com>
<415799ff-89bb-a78e-2f79-7f29834d0460@enterprisedb.com>
<20210222042243.2tnmt4ozz2rnohfw@alap3.anarazel.de>
On 22.02.21 05:22, Andres Freund wrote:
> Hi,
>
> On 2021-02-19 15:53:32 +0100, Markus Wanner wrote:
>> However, more generally speaking, I suspect you are overthinking this. All
>> of the complexity arises because of the assumption that an output plugin
>> receiving and confirming a PREPARE may not be able to persist that first
>> phase of transaction application. Instead, you are trying to somehow
>> resurrect the transactional changes and the prepare at COMMIT PREPARED time
>> and decode it in a deferred way.
>
> The output plugin should never persist anything.
Sure, sorry, I was sloppy in formulation. I meant the replica or client
that receives the data from the output plugin. Given it asked for
two-phase commits in the output plugin, it clearly is interested in the
PREPARE.
> That's the job of the
> client, not the output plugin. The output plugin simply doesn't have the
> information to know whether the client received data and successfully
> applied data or not.
Exactly. Therefore, it should not randomly reshuffle or reorder
PREPAREs until after other COMMITs.
> The output plugin doesn't set / influence start_decoding_at (unless you
> want to count just ERRORing out).
Yeah, same sloppiness, sorry.
>> With that line of thinking, the point in time (or in WAL) of the COMMIT
>> PREPARED does not matter at all to reason about the decoding of the PREPARE
>> operation. Instead, there are only exactly two cases to consider:
>>
>> a) the PREPARE happened before the start_decoding_at LSN and must not be
>> decoded. (But the effects of the PREPARE must then be included in the
>> initial synchronization. If that's not supported, the output plugin should
>> not enable two-phase commit.)
>
> I don't think that can be made work without disproportionate
> complexity. Especially not in cases where we start to be CONSISTENT
> based on pre-existing on-disk snapshots.
Well, the PREPARE to happen before the start_decoding_at LSN is a case
the output plugin needs to deal with. I pointed out why the current way
of dealing with it clearly is wrong.
What issues do you see with the approach I proposed?
Regards
Markus
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: markus.wanner@enterprisedb.com, andres@anarazel.de, itsajin@gmail.com, amit.kapila16@gmail.com, robertmhaas@gmail.com, simon.riggs@enterprisedb.com, petr.jelinek@enterprisedb.com
Subject: Re: repeated decoding of prepared transactions
In-Reply-To: <a73fa714-b0ff-54f5-f915-d4f13d210789@enterprisedb.com>
References: <d0f60d60-133d-bf8d-bd70-47784d8fabf3@enterprisedb.com> <CAA4eK1L5aX1BL9Xg-wSULbFeB417G0v9qk5qZ6NbYCkCo6JUGQ@mail.gmail.com> <CAA4eK1JLVfB9hiczRyTt6qLmw90qR3-9ZzeZnHi-52nEw5_SYg@mail.gmail.com> <CAFPTHDbbth0XVwf=WXcmp=_2nU5oNaK4CxetUr22qi1UM5v6rw@mail.gmail.com> <415799ff-89bb-a78e-2f79-7f29834d0460@enterprisedb.com> <20210222042243.2tnmt4ozz2rnohfw@alap3.anarazel.de> <a73fa714-b0ff-54f5-f915-d4f13d210789@enterprisedb.com>
* 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