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 1jbOL2-0003Ko-MD for pgsql-general@arkaria.postgresql.org; Wed, 20 May 2020 13:00:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jbOL1-0003js-HH for pgsql-general@arkaria.postgresql.org; Wed, 20 May 2020 13:00:47 +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 1jbOL0-0003jl-LL for pgsql-general@lists.postgresql.org; Wed, 20 May 2020 13:00:47 +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 1jbOKt-0003Bz-QS for pgsql-general@lists.postgresql.org; Wed, 20 May 2020 13:00:45 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.nyi.internal (Postfix) with ESMTP id 834AF194220D; Wed, 20 May 2020 09:00:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 20 May 2020 09:00:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=cdDzIITld05uZbKyiBRn/6mMt9vOtXrQyO1/upoO3 Lc=; b=zhTbm/QFRQsryYzbP9NyQl02btH8laBrauuJw4Y8DWqqNAofiP3DATiRm fsicY7ZJGAAZMSfLb5ZlTJ53n7KAEVYQ8m+gUMj+e5pYd1IwiGCxoNqlujfC5Mjd QNZn6O2EJatck6t/JWCDwznr9NIeplrdlgsHXqUVMFfEtVDI34st2+bhVZo6kjip U6tezAacrTWqtNmodrppoNKzdaSJAc2E0fb8U7rKtzBQCpma2sblvrtHYvVFWHJw fo0uHq/btUem4j5/oOfnTb8ViYhpIwmW7jDsU6zYPJ06abJdQCzgn4oqipyu5MJ7 Gf4r75VsleKeAkfkJB1E8DaiOgMrQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddtledgheejucetufdoteggodetrfdotf 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 6BA673280059; Wed, 20 May 2020 09:00:37 -0400 (EDT) Subject: Re: Logical replication troubles To: =?UTF-8?Q?Anders_B=c3=b8gh_Bruun?= , pgsql-general@lists.postgresql.org References: From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <7ad3f1d0-b9ee-d914-ad57-16f07686ee9d@2ndquadrant.com> Date: Wed, 20 May 2020 15:00:35 +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-19 09:22, Anders Bøgh Bruun wrote: > I have run into a (to me) weird issue with logical replication. We are > running Zalandos postgres-operator in our Kubernetes clusters and have > recently had a use-case where we wanted to start doing logical > replication of select tables to a data warehouse, also running postgres. > It worked as expected at first, but then after a pod-restart in > Kubernetes, the replication slots that were created for the subscription > were gone. A bit of reading later, and I learn we need to tell Patroni > which slots should be permanently available, so we specify a slot and > try to set this up, but then run into an error which says the > publication does not exist, even though we can verify that it does. At > first I suspected Patroni handling the replication slots to be the cause > of the problem, but about a week's worth of learning and experimenting > later, I can now reliably replicate the problem in pure postgres. > Patroni is kind of the catalyst, since my findings are that if the > replication slot is created before data is inserted into the source > database, and a publication is created, then it breaks. If the > replication slot is created after data is inserted and the publication > is created, then it works. We just can't tell Patroni to not create it > until some arbitrary point in time. I am guessing this is either a bug > or a case of us not knowing what we are doing... What does "works" and "breaks" mean? Are there error messages shown from commands or in the server logs? Is replication progressing, but doing something your are not expecting? etc. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services