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 1nHAgb-00059k-DJ for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Feb 2022 20:32:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nHAgZ-0002Zg-Tb for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Feb 2022 20:32:31 +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 1nHAgX-0002ZW-SZ for pgsql-hackers@lists.postgresql.org; Mon, 07 Feb 2022 20:32:31 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nHAgT-0005xi-Hn for pgsql-hackers@postgresql.org; Mon, 07 Feb 2022 20:32:28 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 28AA15C0079; Mon, 7 Feb 2022 15:32:24 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 07 Feb 2022 15:32:24 -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; bh=VBuWnAawSS626y9ywcPwwmXWEEBDiurApfCkdl wyBe4=; b=xl5Dd4Yfcdey+MGGdXlWo9fhKK9SlCkOlXabome8qGBbJ++DpbllXE HKV/Cx/fvIODaa7GztWvxiNM0CrsqKyOSi3ijgur4LQl+0faFaa/vctYoszDUPRd 3jdUIdK30NB5LdZw9MnrSatf2rkAB+6VL7SPK5x8xJ8XNTBsnExvR9UFH/wxqkKA ivzMDKW31BUN18k9WqlXPfcYtcJKqXdVnGZ2WXxP4gM8QAuuGxwbokN6qQDSGAdp AkPDhj8RP2v/4oWVmPD2/15V5G55tZU47hyawEDfrMyMPpTQghJv44skWI8e3y1K FT75+HWxce7MUUfZoJBTUOSFy4RwrsuQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; 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:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=VBuWnAawSS626y9yw cPwwmXWEEBDiurApfCkdlwyBe4=; b=YmIVJkSBUQJvcC+dm3FBWa0A7Ga34e8gP s7oca7HF5lLBUaMmqfd/ouMJ4wqts87ehbMO3qfgNc0ddD9N9s4weE6WDp0Af1PG DMleGneXTU1Z2+Tza+QtMsNgKfrjc2ki5PCniWXpG55ngr3Zl5AHx8hRnIdyDAWu tNYHEOhzyVDM9zoK4hytOLwii0c4qvJ150sUx3yyFt5UUfkeb7nmLoPgCfDbD71M yNgVo5HGVohWR8N0tsvXM0eJTv2VnngX2YA8sSKXD+AdwEMTvOxdvVD0rNGo39t/ gXdXDNWgXEjmZDSKpKl9v+/LGhp3NvqwpVmNeOsVmzDDRKxLRfTuw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrheehgddufeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpedukefhkeelueegveetheelffffjeegleeuudelfeefuedtleffueejfffh ueffudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Feb 2022 15:32:23 -0500 (EST) Date: Mon, 7 Feb 2022 12:32:22 -0800 From: Andres Freund To: Ashutosh Sharma Cc: Peter Eisentraut , pgsql-hackers Subject: Re: Synchronizing slots from primary to standby Message-ID: <20220207203222.22aktwxrt3fcllru@alap3.anarazel.de> References: <514f6f2f-6833-4539-39f1-96cd1e011f23@enterprisedb.com> <18dbc929-a281-8552-4f1d-7e4d0e4eedba@enterprisedb.com> <646acd8d-9896-ed8d-2ab4-0bf11b3285d4@enterprisedb.com> <20220205195944.drwc3psrb5udt2cw@alap3.anarazel.de> 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 2022-02-07 13:38:38 +0530, Ashutosh Sharma wrote: > Are you talking about this scenario - what if the logical replication > slot on the publisher is dropped, but is being referenced by the > standby where the slot is synchronized? It's a bit hard to say, because neither in this thread nor in the patch I've found a clear description of what the syncing needs to & tries to guarantee. It might be that that was discussed in one of the precursor threads, but... Generally I don't think we can permit scenarios where a slot can be in a "corrupt" state, i.e. missing required catalog entries, after "normal" administrative commands (i.e. not mucking around in catalog entries / on-disk files). Even if the sequence of commands may be a bit weird. All such cases need to be either prevented or detected. As far as I can tell, the way this patch keeps slots on physical replicas "valid" is solely by reorderbuffer.c blocking during replay via wait_for_standby_confirmation(). Which means that if e.g. the standby_slot_names GUC differs from synchronize_slot_names on the physical replica, the slots synchronized on the physical replica are not going to be valid. Or if the primary drops its logical slots. > Should the redo function for the drop replication slot have the capability > to drop it on standby and its subscribers (if any) as well? Slots are not WAL logged (and shouldn't be). I think you pretty much need the recovery conflict handling infrastructure I referenced upthread, which recognized during replay if a record has a conflict with a slot on a standby. And then ontop of that you can build something like this patch. Greetings, Andres Freund