From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Petr Jelinek <petr@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Henry Hinze <henry.hinze@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Subject: Re: BUG #16643: PG13 - Logical replication - initial startup never finishes and gets stuck in startup loop
Date: Wed, 4 Nov 2020 10:49:31 -0300
Message-ID: <20201104134931.GA6515@alvherre.pgsql> (raw)
In-Reply-To: <CAA4eK1+X=LTv4miqL4myJFSzJUJUk0An2sp1Hx2Cupnt8G+eww@mail.gmail.com>
On 2020-Nov-04, Amit Kapila wrote:
> On Thu, Oct 15, 2020 at 8:20 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> > * STREAM COMMIT bug?
> > In apply_handle_stream_commit, we do CommitTransactionCommand, but
> > apparently in a tablesync worker we shouldn't do it.
>
> In the tablesync stage, we don't allow streaming. See pgoutput_startup
> where we disable streaming for the init phase. As far as I understand,
> for tablesync we create the initial slot during which streaming will
> be disabled then we will copy the table (here logical decoding won't
> be used) and then allow the apply worker to get any other data which
> is inserted in the meantime. Now, I might be missing something here
> but if you can explain it a bit more or share some test to show how we
> can reach here via tablesync worker then we can discuss the possible
> solution.
Hmm, okay, that sounds like there would be no bug then. Maybe what we
need is just an assert in apply_handle_stream_commit that
!am_tablesync_worker(), as in the attached patch. Passes tests.
Attachments:assert.patch (text/x-diff, 507B) downloaddiff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.cindex 04684912de..09f246fc1f 100644--- a/src/backend/replication/logical/worker.c+++ b/src/backend/replication/logical/worker.c@@ -949,6 +949,9 @@ apply_handle_stream_commit(StringInfo s)
MemoryContext oldcxt;
BufFile *fd;
+ /* We don't allow streaming in tablesync */+ Assert(!am_tablesync_worker());+
Assert(!in_streamed_transaction);
xid = logicalrep_read_stream_commit(s, &commit_data);
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-bugs@postgresql.org
Cc: alvherre@alvh.no-ip.org, amit.kapila16@gmail.com, petr@2ndquadrant.com, tgl@sss.pgh.pa.us, henry.hinze@gmail.com, pgsql-bugs@lists.postgresql.org, peter.eisentraut@2ndquadrant.com
Subject: Re: BUG #16643: PG13 - Logical replication - initial startup never finishes and gets stuck in startup loop
In-Reply-To: <20201104134931.GA6515@alvherre.pgsql>
* 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