From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Anders Bøgh Bruun <anders@cellpointdigital.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Logical replication troubles
Date: Fri, 22 May 2020 11:00:11 +0200
Message-ID: <e0885261-5723-7bab-f541-e6a260f50328@2ndquadrant.com> (raw)
In-Reply-To: <CAMnwvPyW_8q_2dHePPdbg+=nDW11oBzxDdqW+269=TLC6Ox1NQ@mail.gmail.com>
References: <CAMnwvPwBgkmaMZapP_wgXZwxGZymuaYuqNykGLiMG4K+rGmBaQ@mail.gmail.com>
<7ad3f1d0-b9ee-d914-ad57-16f07686ee9d@2ndquadrant.com>
<CAMnwvPyW_8q_2dHePPdbg+=nDW11oBzxDdqW+269=TLC6Ox1NQ@mail.gmail.com>
On 2020-05-20 17:16, Anders Bøgh Bruun wrote:
> [67] LOG: logical replication apply worker for subscription
> "widgets_sub" has started
> [67] DEBUG: connecting to publisher using connection string
> "dbname=testdb host=master port=5432 user=repuser password=abc123"
> [67] ERROR: could not receive data from WAL stream: ERROR: publication
> "widgets_pub" does not exist
> CONTEXT: slot "my_slot", output plugin "pgoutput", in the change
> callback, associated LSN 0/1674958
> [1] DEBUG: unregistering background worker "logical replication worker
> for subscription 16396"
> [1] LOG: background worker "logical replication worker" (PID 67) exited
> with exit code 1
>
> I can verify that the publication called widgets_pub does exist, and I
> am not seeing any errors on the sending side.
>
> The SQL-file named "works" just has the creation of the replication slot
> moved down to after I insert some data into the table I want to
> replicate. And that works as expected.
You need to create the publication before the replication slot. The
walsender's view of the world moves along with the WAL it is
decoding/sending. So when the subscription worker connects, it
initially sees a state as of the creation of the replication slot, when
the publication did not exist yet.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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-general@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com, anders@cellpointdigital.com
Subject: Re: Logical replication troubles
In-Reply-To: <e0885261-5723-7bab-f541-e6a260f50328@2ndquadrant.com>
References: <CAMnwvPwBgkmaMZapP_wgXZwxGZymuaYuqNykGLiMG4K+rGmBaQ@mail.gmail.com> <7ad3f1d0-b9ee-d914-ad57-16f07686ee9d@2ndquadrant.com> <CAMnwvPyW_8q_2dHePPdbg+=nDW11oBzxDdqW+269=TLC6Ox1NQ@mail.gmail.com> <e0885261-5723-7bab-f541-e6a260f50328@2ndquadrant.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