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 1rp8QZ-005F5Q-63 for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Mar 2024 15:09:27 +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 1rp8QY-00GkK5-9b for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Mar 2024 15:09:26 +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 1rp8QX-00GkJr-Vv for pgsql-hackers@lists.postgresql.org; Tue, 26 Mar 2024 15:09:25 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rp8QU-006bLq-UY; Tue, 26 Mar 2024 15:09:25 +0000 Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-7d0486cf91aso112514039f.1; Tue, 26 Mar 2024 08:09:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711465761; x=1712070561; darn=postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=BR9bii1Jw7NfY3BapTUMuE62lK7Qp72Ba9kdUWdXMYQ=; b=G/p2hQAd52E8ncJdCrt4mNB7qUGrLetL2ZjEApQ3T4n5A6evqqb0B2FByLCn8ypcuR 3v+0l93eCOV+os6R3RxldsXyCe/KCHLjtDuziZ0rCGCHKomHfqcjZn9GhdFuEEZz9I+4 NdEfmvZBIvlgQX8BVueBFVZNJUpfOEy6dnBJbRkHSth73aqYJYzBbQjP3S5OEk8Anor9 a6l/eD+t7axU2b00qI+UofLKUuccJFef2HwHAr52NQgNK678+MOaYe8pibhpTgMH66U2 TlNGNNDQNwIawGxHXgvj5/JOUs3GUztDYJ0jfGT5DKOim/lrbB17/9x8/4znzX0XahiV yktQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711465761; x=1712070561; h=in-reply-to:content-transfer-encoding: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=BR9bii1Jw7NfY3BapTUMuE62lK7Qp72Ba9kdUWdXMYQ=; b=VJ9cqrg4ih+kmab4zK2Uod0CApclQfbkN7pLDqmYObxSSQQZd9546D0coeucIRvHpB nVRjakallVirGYbACCAiAyP8jqJIF3GuIN6Izs2o0IOJXClw5NfZ5uILs17bz84JGI+I H1vdGfvVn9dXdAcIajlGRkLAHKAJlH5h7Id4WTtorMRX+MAppb2JStRummQpc7Gm7gdz FylTlifr6Jcsa+iChi5f5ffOj7zn1vACjAlJKSFFi+u4lxu3UrTUXOdzI1A4YZifU+0M W8Qyr0ZfVc6N+BCjXZ8PGSU4M25HKgdgTuu3Qw37iDfZOkfjCj2mai1BAA/d3NyPHlGt Zq1g== X-Forwarded-Encrypted: i=1; AJvYcCX30KmHGBwZ11LMEGQ0hpRWz3a5ix7Gs2v5LUUeZ0hrtxv3XYZ83oZfi9U7857Gh3323x7czMU0SVDKFM6WLBwpAm9t1+/f3DF38YKrtrlvs8+8VJEvGCzbVVNZYOiyBtp/QkEQ X-Gm-Message-State: AOJu0Yx5eeSLOBTrYkkpWjOZmnogog3KLCYjL3eMvSVea11SkdpvFzgO lTA8DYTOh8PsSfF1kUfQhIFqmcOdx3lqN3lDngFBVBWAjYUe/034 X-Google-Smtp-Source: AGHT+IEQYRalmQJS/9/nugUx9osDJiqgO+wjUOR2reEyiOiVdr3/si4Qk+atseEPzFohWe8hlVnvzA== X-Received: by 2002:a5e:a914:0:b0:7cf:18eb:a6e7 with SMTP id c20-20020a5ea914000000b007cf18eba6e7mr9539835iod.9.1711465760931; Tue, 26 Mar 2024 08:09:20 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id b13-20020a02a58d000000b0047bdac95b4csm2741754jam.124.2024.03.26.08.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 08:09:20 -0700 (PDT) Date: Tue, 26 Mar 2024 10:09:18 -0500 From: Nathan Bossart To: Amit Kapila Cc: Alvaro Herrera , 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: <20240326150918.GB3181099@nathanxps13> References: <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 Tue, Mar 26, 2024 at 03:44:29PM +0530, Amit Kapila wrote: > On Tue, Mar 26, 2024 at 2:11 PM Alvaro Herrera wrote: >> 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. > > The inactive slot not only blocks WAL from being removed but prevents > the vacuum from proceeding. Also, there is a risk of transaction Id > wraparound. See email [1] for more context. FWIW I'd really prefer to have something like max_slot_xid_age for this. A time-based parameter would likely help with most cases, but transaction ID usage will vary widely from server to server, so it'd be nice to have something to protect against wraparound more directly. I don't object to a time-based setting as well, but that won't always work as well for this particular use-case, especially if we are relying on users to set a slot-level parameter. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com