pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Wanner <markus.wanner@enterprisedb.com>
To: Amit Kapila <amit.kapila16@gmail.com>
To: Markus Wanner <markus.wanner@enterprisedb.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Ajin Cherian <itsajin@gmail.com>
Cc: Simon Riggs <simon@enterprisedb.com>
Cc: ashutosh.bapat.oss@gmail.com
Cc: petr.jelinek@enterprisedb.com
Subject: Re: repeated decoding of prepared transactions
Date: Mon, 8 Feb 2021 16:06:30 +0100
Message-ID: <e7c6a5c6-f1a8-fb89-3080-e7f5ad0f35da@enterprisedb.com> (raw)
In-Reply-To: <CAA4eK1K0qdpQtpKX7KJjyKjvMWEdZ9qAUaZ9iXoU9zsgChEseQ@mail.gmail.com>
References: <d0f60d60-133d-bf8d-bd70-47784d8fabf3@enterprisedb.com>
	<CAA4eK1K0qdpQtpKX7KJjyKjvMWEdZ9qAUaZ9iXoU9zsgChEseQ@mail.gmail.com>

Hello Amit,

thanks for your very quick response.

On 08.02.21 11:13, Amit Kapila wrote:
> /*
>   * It is possible that this transaction is not decoded at prepare time
>   * either because by that time we didn't have a consistent snapshot or it
>   * was decoded earlier but we have restarted. We can't distinguish between
>   * those two cases so we send the prepare in both the cases and let
>   * downstream decide whether to process or skip it. We don't need to
>   * decode the xact for aborts if it is not done already.
>   */

The way I read the surrounding code, the only case a 2PC transaction 
does not get decoded a prepare time is if the transaction is empty.  Or 
are you aware of any other situation that might currently happen?

> (unless the server needs to be restarted due to some reason)

Right, the repetition occurs only after a restart of the walsender in 
between a prepare and a commit prepared record.

> That anyway is true without this work as well where restart_lsn can be
> advanced on commits. We haven't changed anything in that regard.

I did not mean to blame the patch, but merely try to understand some of 
the design decisions behind it.

And as I just learned, even if we managed to avoid the repetition, a 
restarted walsender still needs to see prepared transactions as 
in-progress in its snapshots.  So we cannot move forward the restart_lsn 
to after a prepare record (until the final commit or rollback is consumed).

Best Regards

Markus





view thread (72+ messages)  latest in thread

Message-ID: <e7c6a5c6-f1a8-fb89-3080-e7f5ad0f35da@enterprisedb.com>
Permalink:  ../e7c6a5c6-f1a8-fb89-3080-e7f5ad0f35da@enterprisedb.com/
Also on:    postgresql.org/message-id/e7c6a5c6-f1a8-fb89-3080-e7f5ad0f35da@enterprisedb.com

 · 

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 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, amit.kapila16@gmail.com, itsajin@gmail.com, simon@enterprisedb.com, ashutosh.bapat.oss@gmail.com, petr.jelinek@enterprisedb.com
  Subject: Re: repeated decoding of prepared transactions
  In-Reply-To: <e7c6a5c6-f1a8-fb89-3080-e7f5ad0f35da@enterprisedb.com>
  References: <d0f60d60-133d-bf8d-bd70-47784d8fabf3@enterprisedb.com> <CAA4eK1K0qdpQtpKX7KJjyKjvMWEdZ9qAUaZ9iXoU9zsgChEseQ@mail.gmail.com> <e7c6a5c6-f1a8-fb89-3080-e7f5ad0f35da@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