Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rp2Mz-004jKK-UL for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Mar 2024 08:41:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rp2My-00CrAB-6q for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Mar 2024 08:41:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rp2Mw-00Cr9t-TC for pgsql-hackers@lists.postgresql.org; Tue, 26 Mar 2024 08:41:20 +0000 Received: from wfhigh7-smtp.messagingengine.com ([64.147.123.158]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rp2Mo-006VDi-GY; Tue, 26 Mar 2024 08:41:17 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.west.internal (Postfix) with ESMTP id AE5161800114; Tue, 26 Mar 2024 04:41:08 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 26 Mar 2024 04:41:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1711442468; x= 1711528868; bh=KZOBtU//jigYOVA0yDuEoz0Oqb3jhSAzEigYN9dLguU=; b=N yh7RfeqjKsO/VonLTCYHaf3KH/i2eZy9OtZ5JFSRogzzM/3bExdkUP2i4X4Xkh0J wikyPITI7cG9h6yx9bYA4RWjSbsH4q7+is4sdQJ/jEld66vUukVHF8BPMcDg1VUB KtuAueQQxtmUatXy+Dz584gnkmETHZe6eZTVsus9e1R9SpBEFcdI6xrSN5JE7Q/K l6BC16oR4dtpKzxHP+J5peRjmm22TB6wpnyCjaSRaJtX/frNiWhjD/yyqvKul7UL 7SO4tNkm3+L0P+DwXINAGc86/RGjmKaWrySoeqTkrsbU0D6aKxkHD0H1tUKMzE/I X93T6+rhaqKwVewwwLMAA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudduvddguddvfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeej keffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghl vhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 26 Mar 2024 04:41:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1711442465; bh=938BZzlUFJ6ppa4A7gszRuzETRwVUICHdgxooKU8EWI=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=jVv/uGqNSZe6xHaeMnyE22i5hEs8QZ5+06npsueFXF95lyRmI7o0LX9ktAwU3HvQ5 8ieua530w7fghO+7JTGbDwXEl7ts2Hx2PGhM9DbbLuBOPJB6+d/uynFI9wz2Ty9Nbd NEMOAZTal4x6dUXV41Lu/lsjyMA8AaTfcIj4zdqsGx0hxWgnS6SNWDBzIVjdffz+ux NbEtWUQPCHKmOTtNJlz3RU4Yr+Uc5no+xCnsoKcP+0YD3GIMHYkC/CvNn9D3BB2PO4 nisWxlvFZRCOtbaCU5KIL6PB37hKDhrZzoOXHON0j6+dzC7V1yKDgx8kN02oiFNZxn o/kOvs0LZR+vQ== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 35033153; Tue, 26 Mar 2024 09:41:05 +0100 (CET) Date: Tue, 26 Mar 2024 09:41:05 +0100 From: Alvaro Herrera To: Amit Kapila Cc: Robert Haas , Bertrand Drouvot , shveta malik , Bharath Rupireddy , Amit Kapila , "pgsql-hackers@postgresql.org" Subject: Re: pgsql: Track last_inactive_time in pg_replication_slots. Message-ID: <202403260841.5jcv7ihniccy@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Mar-26, Amit Kapila wrote: > On Tue, Mar 26, 2024 at 1:09 PM Alvaro Herrera wrote: > > On 2024-Mar-26, Amit Kapila wrote: > > > I would also like to solicit your opinion on the other slot-level > > > parameter we are planning to introduce. This new slot-level parameter > > > will be named as inactive_timeout. > > > > Maybe inactivity_timeout? > > > > > This will indicate that once the slot is inactive for the > > > inactive_timeout period, we will invalidate the slot. We are also > > > discussing to have this parameter (inactive_timeout) as GUC [1]. We > > > can have this new parameter both at the slot level and as well as a > > > GUC, or just one of those. > > > > replication_slot_inactivity_timeout? > > So, it seems you are okay to have this parameter both at slot level > and as a GUC. Well, I think a GUC is good to have regardless of the slot parameter, because the GUC can be used as an instance-wide protection against going out of disk space because of broken replication. However, now that I think about it, I'm not really sure about invalidating a slot based on time rather on disk space, for which we already have a parameter; what's your rationale for that? The passage of time is not a very good measure, really, because the amount of WAL being protected has wildly varying production rate across time. I can only see a timeout being useful as a parameter if its default value is not the special disable value; say, the default timeout is 3 days (to be more precise -- the period from Friday to Monday, that is, between DBA leaving the office one week until discovering a problem when he returns early next week). This way we have a built-in mechanism that invalidates slots regardless of how big the WAL partition is. I'm less sure about the slot parameter; in what situation do you need to extend the life of one individual slot further than the life of all the other slots? (Of course, it makes no sense to set the per-slot param to a shorter period than the GUC: invalidating one slot ahead of the others is completely pointless.) -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ Bob [Floyd] used to say that he was planning to get a Ph.D. by the "green stamp method," namely by saving envelopes addressed to him as 'Dr. Floyd'. After collecting 500 such letters, he mused, a university somewhere in Arizona would probably grant him a degree. (Don Knuth)