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 1pG287-00076H-MB for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Jan 2023 18:16:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pG285-0001qg-MB for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Jan 2023 18:16:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pG285-0001qI-Cv for pgsql-hackers@lists.postgresql.org; Thu, 12 Jan 2023 18:16:45 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pG27x-00075Q-Sp for pgsql-hackers@postgresql.org; Thu, 12 Jan 2023 18:16:44 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 881B0320091C; Thu, 12 Jan 2023 13:16:32 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 12 Jan 2023 13:16:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1673547392; x=1673633792; bh=7CElIO+w9s iXL53S1dv7egVu+17uebshac5qewfNFWg=; b=RfF3Oj+rYEPlv1gXzHIVyvLQEA koZgrhUXGKKke5quHm9NyNvVF8yiskfTogx7d63H+u6mKv3xkTOswUKCNtG1sxE6 AoxdcvyueuilCntgtkiBG+ESaqi9FMJJhl8K5dNYNSyqVZki9vy49onjME94T8Qr EVAvUbBib0emylsA1FGe+AwD7aD+aG9Hys6yN/vUFPraTEMeFC7BJS627NaG2vCg mMROHv/OEs4qBFoeXsf5V3J80wLSlORAtAaprtzy3rX29Vubt5RhUMZnu4ht9cec tvzvQUiQUAKxGY1YCE7CD5DyGgjkaG3HZK9wNZvzhAuwo8fiRi2ZlPc6LcuQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1673547392; x=1673633792; bh=7CElIO+w9siXL53S1dv7egVu+17u ebshac5qewfNFWg=; b=cJM97UQfBrmSxu/6a2kY41n0zD+L3QkoCYh6kjD6J7xh V4rQSyaWPX3dVJJ3/3czAmrNX4OEGMrN5/nJ9nW3GLvTxbXMX0r3HdAJjawsTMWs 7QgIIdzv6ZbmyXytKv3/RxlB9WITFwslxUmdbYQZu/3rQ8KMdr9xcD70S0wJK4Wx irc9Z8Ow+ZQag6cBc+Ohb+qKKWj6i1hIikl8T6MqyUCskvtKuEnTZ9piytie+vmi TwFee4i98qTH7+hWyKL7lMfN1k6EQR9K9g4zRGfOrEJMp8N0R3mNKrQfzVJtkQLH yfVyhAqWl7fHbCTgiT4n60VEMNfHW5urvdn8SHbsqg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrleeigdduudduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetvedu ieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 12 Jan 2023 13:16:31 -0500 (EST) Date: Thu, 12 Jan 2023 10:16:30 -0800 From: Andres Freund To: Ashutosh Sharma Cc: "Drouvot, Bertrand" , Robert Haas , Thomas Munro , Alvaro Herrera , Ibrar Ahmed , Amit Khandekar , fabriziomello@gmail.com, tushar , Rahila Syed , pgsql-hackers Subject: Re: Minimal logical decoding on standbys Message-ID: <20230112181630.lpqqty2vzuatgwcl@awork3.anarazel.de> References: <1f2ad9fd-53ff-74cc-a602-72d45423bcab@gmail.com> <05c0c4f3-82eb-bc6d-c876-5a265c05927b@gmail.com> <20230106034036.2m4qnn7ep7b5ipet@awork3.anarazel.de> <805540ba-b132-30f2-563d-cf9acc527008@gmail.com> <2d62f212-fce6-d639-b9eb-2a5bc4bec3b4@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-01-12 20:08:55 +0530, Ashutosh Sharma wrote: > I previously participated in the discussion on "Synchronizing the > logical replication slots from Primary to Standby" and one of the > purposes of that project was to synchronize logical slots from primary > to standby so that if failover occurs, it will not affect the logical > subscribers of the old primary much. Can someone help me understand > how we are going to solve this problem with this patch? Are we going > to encourage users to do LR from standby instead of primary to get rid > of such problems during failover? It only provides a building block towards that. The "Synchronizing the logical replication slots from Primary to Standby" project IMO needs all of the infrastructure in this patch. With the patch, a logical rep solution can e.g. maintain one slot on the primary and one on the standby, and occasionally forward the slot on the standby to the position of the slot on the primary. In case of a failover it can just start consuming changes from the former standby, all the necessary changes are guaranteed to be present. > Also, one small observation: > > I just played around with the latest (v38) patch a bit and found that > when a new logical subscriber of standby is created, it actually > creates two logical replication slots for it on the standby server. > May I know the reason for creating an extra replication slot other > than the one created by create subscription command? See below: That's unrelated to this patch. There's no changes to the "higher level" logical replication code dealing with pubs and subs, it's all on the "logical decoding" level. I think this because logical rep wants to be able to concurrently perform ongoing replication, and synchronize tables added to the replication set. The pg_16399_sync_16392_7187728548042694423 slot should vanish after the initial synchronization. Greetings, Andres Freund