Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jc3XO-0004tR-Pu for pgsql-general@arkaria.postgresql.org; Fri, 22 May 2020 09:00:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jc3XN-00079u-GO for pgsql-general@arkaria.postgresql.org; Fri, 22 May 2020 09:00:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jc3XN-00079n-8B for pgsql-general@lists.postgresql.org; Fri, 22 May 2020 09:00:17 +0000 Received: from forward5-smtp.messagingengine.com ([66.111.4.239]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jc3XK-0001GZ-CP for pgsql-general@lists.postgresql.org; Fri, 22 May 2020 09:00:16 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.nyi.internal (Postfix) with ESMTP id 70C3D19425EF; Fri, 22 May 2020 05:00:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 22 May 2020 05:00:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=2tnFZEnkYWW8HUCjVJXBJn4FXss/nqWCc98lAi4VW vg=; b=cyocpKbxtL4slm3DfXv1hcad3jtyU/H/MAjp3VzksRIRdmZgL1ilotRy2 I2iv+9L0m67r2qXuosbt+KqN+9TelU/uEOs8IE1NK4Aduq6RENRToiULKRzb92j1 bMbPnjpPVgVBggxRyl+/DvmRjFkiSCkffBcH8Wqdrb+A8dSV3HTNIgePX06ObGuK ujfWJ4WRbt6VDpaRi7cykVNZ0eluOJy6D0A79OB0qQrHlQiQxLpIywAkdpZkSP5e ubVyJmCWj6rjWXzf2DfTDhfSLm3gV0p+0vmk+m3voom7KWaPUYHUC8XexAv3jC3U eyIE3C+bc0G+yK0FpJHbm0HjH3itQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddufedguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhohfkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvdhnug hquhgrughrrghnthdrtghomheqnecuggftrfgrthhtvghrnhepleffffetffejfefhheff veekieetieekudeffffhheevieelhfethfegfeduhedtnecuffhomhgrihhnpedvnhguqh hurggurhgrnhhtrdgtohhmnecukfhppeelfedrvdegfedrkedvrddvgeeinecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghish gvnhhtrhgruhhtsedvnhguqhhurggurhgrnhhtrdgtohhm X-ME-Proxy: Received: from april.pezone.net (p5df352f6.dip0.t-ipconnect.de [93.243.82.246]) by mail.messagingengine.com (Postfix) with ESMTPA id 845A23065F0F; Fri, 22 May 2020 05:00:12 -0400 (EDT) Subject: Re: Logical replication troubles To: =?UTF-8?Q?Anders_B=c3=b8gh_Bruun?= References: <7ad3f1d0-b9ee-d914-ad57-16f07686ee9d@2ndquadrant.com> Cc: pgsql-general@lists.postgresql.org From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Fri, 22 May 2020 11:00:11 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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