From: Andres Freund <andres@anarazel.de>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Cc: 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: Petr Jelinek <petr.jelinek@enterprisedb.com>
Subject: Re: repeated decoding of prepared transactions
Date: Sat, 13 Feb 2021 08:32:37 -0800
Message-ID: <20210213163237.wuujppnhoygomool@alap3.anarazel.de> (raw)
In-Reply-To: <CAA4eK1LE8ZtqtDEGqgk2WYgKAzBysZg_p=dDfPF2MUYhSQEMQQ@mail.gmail.com>
References: <d0f60d60-133d-bf8d-bd70-47784d8fabf3@enterprisedb.com>
<CAA4eK1K0qdpQtpKX7KJjyKjvMWEdZ9qAUaZ9iXoU9zsgChEseQ@mail.gmail.com>
<e7c6a5c6-f1a8-fb89-3080-e7f5ad0f35da@enterprisedb.com>
<CAA4eK1J1vD65Y9xsue_nsrJvm5erMU2PKFZu81PBeD+Z30Rbbw@mail.gmail.com>
<CAExHW5s2JAnYC4vNdes-DGQdjkOBRukUa_LLqRbNmKENLE33kg@mail.gmail.com>
<CAA4eK1+5Sz2UWs+ivm-cbbdDY+TH_3DgRCNRi54+WEHczuRoWg@mail.gmail.com>
<CA+TgmoYvg6GL15uOg3fGTvwKcNGE5q+KhtAERFcdXup_axk+Mg@mail.gmail.com>
<CAA4eK1LE8ZtqtDEGqgk2WYgKAzBysZg_p=dDfPF2MUYhSQEMQQ@mail.gmail.com>
Hi,
On 2021-02-10 08:02:17 +0530, Amit Kapila wrote:
> On Wed, Feb 10, 2021 at 12:08 AM Robert Haas <robertmhaas@gmail.com> wrote:
> >
> > On Tue, Feb 9, 2021 at 6:57 AM Amit Kapila <amit.kapila16@gmail.com> wrote:
> > > I think similar happens without any of the work done in PG-14 as well
> > > if we restart the apply worker before the commit completes on the
> > > subscriber. After the restart, we will send the start_decoding_at
> > > point based on some previous commit which will make publisher send the
> > > entire transaction again. I don't think restart of WAL sender or WAL
> > > receiver is such a common thing. It can only happen due to some bug in
> > > code or user wishes to stop the nodes or some crash happened.
> >
> > Really? My impression is that the logical replication protocol is
> > supposed to be designed in such a way that once a transaction is
> > successfully confirmed, it won't be sent again. Now if something is
> > not confirmed then it has to be sent again. But if it is confirmed
> > then it shouldn't happen.
Correct.
> If by successfully confirmed, you mean that once the subscriber node
> has received, it won't be sent again then as far as I know that is not
> true. We rely on the flush location sent by the subscriber to advance
> the decoding locations. We update the flush locations after we apply
> the transaction's commit successfully. Also, after the restart, we use
> the replication origin's last flush location as a point from where we
> need the transactions and the origin's progress is updated at commit
> time.
That's not quite right. Yes, the flush location isn't guaranteed to be
updated at that point, but a replication client will send the last
location they've received and successfully processed, and that has to
*guarantee* that they won't receive anything twice, or miss
something. Otherwise you've broken the protocol.
Greetings,
Andres Freund
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: andres@anarazel.de, amit.kapila16@gmail.com, robertmhaas@gmail.com, ashutosh.bapat.oss@gmail.com, ashutosh.bapat@enterprisedb.com, markus.wanner@enterprisedb.com, itsajin@gmail.com, simon@enterprisedb.com, petr.jelinek@enterprisedb.com
Subject: Re: repeated decoding of prepared transactions
In-Reply-To: <20210213163237.wuujppnhoygomool@alap3.anarazel.de>
References: <d0f60d60-133d-bf8d-bd70-47784d8fabf3@enterprisedb.com> <CAA4eK1K0qdpQtpKX7KJjyKjvMWEdZ9qAUaZ9iXoU9zsgChEseQ@mail.gmail.com> <e7c6a5c6-f1a8-fb89-3080-e7f5ad0f35da@enterprisedb.com> <CAA4eK1J1vD65Y9xsue_nsrJvm5erMU2PKFZu81PBeD+Z30Rbbw@mail.gmail.com> <CAExHW5s2JAnYC4vNdes-DGQdjkOBRukUa_LLqRbNmKENLE33kg@mail.gmail.com> <CAA4eK1+5Sz2UWs+ivm-cbbdDY+TH_3DgRCNRi54+WEHczuRoWg@mail.gmail.com> <CA+TgmoYvg6GL15uOg3fGTvwKcNGE5q+KhtAERFcdXup_axk+Mg@mail.gmail.com> <CAA4eK1LE8ZtqtDEGqgk2WYgKAzBysZg_p=dDfPF2MUYhSQEMQQ@mail.gmail.com> <20210213163237.wuujppnhoygomool@alap3.anarazel.de>
* 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