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 1rpUqv-0071jr-5I for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Mar 2024 15:06:09 +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 1rpUqu-00Fr5v-5M for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Mar 2024 15:06:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rpUqt-00Fr5n-QQ for pgsql-hackers@lists.postgresql.org; Wed, 27 Mar 2024 15:06:07 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rpUqq-006o5Z-R3; Wed, 27 Mar 2024 15:06:07 +0000 Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-7d026c0a08aso257821539f.1; Wed, 27 Mar 2024 08:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711551963; x=1712156763; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=6/Co0ZCEo3XboHIQAsjtC1FhkZJLcgLJVaUFfpKr+Rg=; b=bqzC4kOeFcfijpXk87jZAcz1ZOXMrYxybzoie9nBTdNmOCzFxb3792R6C6kvhMc4up fc/meWlYShO1OLWjs1evlQxI2CrUDMqVolb3hk0+/N8mPEJtLzAXZUhV7bLsyJQG17fV Jr/kFwcsgSPqNpDBjaTcpH/VhA8wlD2EL81cN2rd7GujFWgPrEDGCRKiipHBycZa2v8g D4tvcROOyJ93OHEaAyVhDufdfvpjnfJQcLwxm7Bm69IteRwkF1p8BcwvlCZXxay3/csu yRQqVw7uXN2kpJ459iocvro1iuJlfurWR2BQ61s9NVHcaoU1jBM9oLqj88d0Q/H2tbSF bxVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711551963; x=1712156763; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6/Co0ZCEo3XboHIQAsjtC1FhkZJLcgLJVaUFfpKr+Rg=; b=jIXpKv2uNr3xe6bQwFPdnGrHG5XjoHNOmjFDj/rYJsv9TwZqLD2prkiJ9IA4wFi1yK bYuzpkVbgWzwL532P5EuROiEUvB4gfEYHr9bQL76LAdSzmKrgnzmpF8LI50BUYGFkhyx cPDq6M443L1E8OatLOmJzAxE/cOrm0sQVTa5S9AwaT+jY34minlu9vsjh02A9R9P/JXu Mi2ziQEdYsg5qsvoB/bMDVHSuCdAgUTN8In3EwoxxIe4wn8F56JLEAUL+XBvIjmMJI/2 VsrbXpHEZdW7Ylqy4uYgmkj4MpKtlKbuSJ2hfiDfWC58zNCt0KNvsLGx7BRM9NkCbSmv Y2kw== X-Forwarded-Encrypted: i=1; AJvYcCUcTOKXoAY9JVHCdEW4ahTv61IJ826TVdi68yI5B2SEnODAMtjpuIvYq7laDf68ZfWngJGTPshiQdZiqHEEUTs3LnEzyKlcclJDdokqk3j08a0SspeKnwiasESj9Om/ZauuuefM X-Gm-Message-State: AOJu0YzDKg9dhk7guOgkhD+rD6kNIXAAqqB3p8MM2NVkV7AzWPi8+CEF exD09Ui5w69R2uwZ4vlMm7Iu8/WwaiSlNfcvQYX2CEDbQw0zx/MK X-Google-Smtp-Source: AGHT+IEfO6c1ndqTpMCvvSUSV5mrU2NgN9bcyC36uB8zhvpxz5tNUfIltwvGKYw4DrgTCiklDewAdg== X-Received: by 2002:a5d:938d:0:b0:7d0:582c:80c4 with SMTP id c13-20020a5d938d000000b007d0582c80c4mr349040iol.19.1711551962592; Wed, 27 Mar 2024 08:06:02 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id t6-20020a02cca6000000b0047bed8cd9cesm3311950jap.81.2024.03.27.08.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 08:06:02 -0700 (PDT) Date: Wed, 27 Mar 2024 10:05:57 -0500 From: Nathan Bossart To: Robert Haas Cc: Bertrand Drouvot , Bharath Rupireddy , Amit Kapila , Alvaro Herrera , shveta malik , Amit Kapila , "pgsql-hackers@postgresql.org" Subject: Re: pgsql: Track last_inactive_time in pg_replication_slots. Message-ID: <20240327150557.GA3994937@nathanxps13> References: <20240326150918.GB3181099@nathanxps13> <202403261539.xcjfle7sksz7@alvherre.pgsql> 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 On Wed, Mar 27, 2024 at 10:33:28AM -0400, Robert Haas wrote: > FWIW, I thought the time-based one sounded more useful. I think it > would be poor planning to say "well, if the slot reaches an XID age of > a billion, kill it so we don't wrap around," because while that likely > will prevent me from getting into wraparound trouble, my database is > likely to become horribly bloated long before the cutoff is reached. I > thought it would be easier to reason in terms of time: I don't expect > a slave to ever be down for more than X period of time, say an hour or > whatever, so if it is, forget about it. Or alternatively, I know that > if a slave does go down for more than X period of time, I start to get > bloat, so cut it off at that point and I'll rebuild it later. I feel > like these are things where people's intuition is going to be much > stronger when reckoning in units of wall-clock time, which everyone > deals with every day in one way or another, rather than in XID-based > units that are, at least in my view, just a lot less intuitive. I don't disagree with this point in the context of a user who is managing a single server or just a handful of servers. They are going to understand their workload best and can reason about the right value for the timeout. I think they'd still benefit from having an XID-based setting as a backstop in case the timeout is still not sufficient to prevent wraparound, but it's not nearly as important in that case. IMHO the use-case where this doesn't work so well is when you have many, many servers to administer (e.g., a cloud provider). In those cases, picking a default timeout to try to prevent wraparound is going to be much less accurate, as any reasonable value you pick is still going to be insufficient in some cases. I think the XID-based parameter would be better here; if the server is at imminent risk of an outage due to wraparound, invalidating the slots is probably a reasonable course of action. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com