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 1se52K-003h2N-8Y for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Aug 2024 03:51:00 +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 1se52I-007wTU-9P for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Aug 2024 03:50:58 +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 1se52H-007wTM-UI for pgsql-hackers@lists.postgresql.org; Wed, 14 Aug 2024 03:50:57 +0000 Received: from mail-yb1-xb29.google.com ([2607:f8b0:4864:20::b29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1se52B-004ksa-KV for pgsql-hackers@lists.postgresql.org; Wed, 14 Aug 2024 03:50:57 +0000 Received: by mail-yb1-xb29.google.com with SMTP id 3f1490d57ef6-dff1ccdc17bso6284281276.0 for ; Tue, 13 Aug 2024 20:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723607450; x=1724212250; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=oz1Ya648F1rqPhjI8wqloTXi/HAojPF3zfH736Vuz64=; b=g3/IOAfEwS3h+g33h7JliTdR8N/wkV/z+eTTIMojc8KxTAUYGAYsFzjZSGRaDZ1+I6 GcYQlEgddr8qGc+13ooBd20riKJEw0XdaUDDTkOSPE38N416LmvJwsCQCXzUdFKgS1LL Mu0Y8PfuOuZ8l8GN8PQwUfMXWqP8sMDOyP4yFuYZyOj9Ua+sRBOJSsWIMqTcyn4NP8+l F7+swKx6q8IYEnmY04PoHcTjVOpqbqb6Kw0tnQsvBnx+sUyt2oSGkcGVNSME08bSzhBL 075G6tfvFu6kxJCxIDJI9+cbeax0/29GQwbhXSMzw7/XSJyKEvDOz1m/fYiRtbUzngD8 uCbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723607450; x=1724212250; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oz1Ya648F1rqPhjI8wqloTXi/HAojPF3zfH736Vuz64=; b=sTSCT5E7anadQyrkyWmhSPC7lrHd2ed3t2tb6m1qpYWInrcHaBRxAzSj7faKIZnBFq MYlSlV4PQbr4ryvzHprmpAN7e4WyluOthqcfk4qygXWEazt21BjL0fb5y9KgdKiiL793 lH2MWxVwX8j/QbjMesRV7Tkzdrpu1z9/eMy425nGqXAZWD9xAPiKOU+xp3f7MSKC3rXx 8Uf0dM9F7/gZmYNepLalzWMoA0W3rMrgZau6cGna0Pz7wuDUtD4EErDAOPQN920N1lA8 zhfnMpcQl+9ALvc220GeCMFlop5roL2GacZ/DFUKQkc1+zrSJf/jqh6ByNl1tFymOQff P7Zw== X-Forwarded-Encrypted: i=1; AJvYcCXxKOS4HpTR+Hdr/Z5Nj/49anOvnaTlTr6RCp2L4HL4PPAnNlU3kcT2e20/44vdjsPRsOHKyEGF3HSpwi0mMdccrrDwnmSgH5TSO0vnuNCb31oU X-Gm-Message-State: AOJu0YztZBVQ6+eyz+4NL+NPtnxeNs6oNq9Px82K7EwyaTpFtyD6Eqam cSpRepYRRRqDIcIJR9HQuZ5KF9WSuvVKDKW+xkTXgfusBEdta2/t9hfY4sgUa+GBvejWJWza7qQ sCymLrYCinRmQcX3w6gIfjrFu4Vc= X-Google-Smtp-Source: AGHT+IH9hp0JyrMTmFZzA1BliVXG10rzBR953vFZRbs3i16Yy4XGpn7xcQrRkULaXN5zS+mR8EdV1F9bXc0ALQlQ7OI= X-Received: by 2002:a05:6902:72a:b0:e0b:b162:ef78 with SMTP id 3f1490d57ef6-e115586fb17mr2002109276.0.1723607449781; Tue, 13 Aug 2024 20:50:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ajin Cherian Date: Wed, 14 Aug 2024 13:50:38 +1000 Message-ID: Subject: Re: Introduce XID age and inactive timeout based replication slot invalidation To: Bharath Rupireddy Cc: Amit Kapila , Bertrand Drouvot , shveta malik , Masahiko Sawada , Nathan Bossart , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="000000000000c6d1f1061f9ca1c9" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c6d1f1061f9ca1c9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 24, 2024 at 4:01=E2=80=AFPM Bharath Rupireddy < bharath.rupireddyforpostgres@gmail.com> wrote: > Hi, > > On Mon, Jun 17, 2024 at 5:55=E2=80=AFPM Bharath Rupireddy > wrote: > > Please find the attached v41 patches implementing the idea of vacuum > doing the invalidation. > > Thoughts? > > > Some minor comments on the patch: 1. + /* + * Release the lock if it's not yet to keep the cleanup path on + * error happy. + */ I suggest rephrasing to: " "Release the lock if it hasn't been already to ensure smooth cleanup on error." 2. elog(DEBUG1, "performing replication slot invalidation"); Probably change it to "performing replication slot invalidation checks" as we might not actually invalidate any slot here. 3. In CheckPointReplicationSlots() + invalidated =3D InvalidateObsoleteReplicationSlots(RS_INVAL_INACTIVE_TIMEOUT, + 0, + InvalidOid, + InvalidTransactionId); + + if (invalidated) + { + /* + * If any slots have been invalidated, recalculate the resource + * limits. + */ + ReplicationSlotsComputeRequiredXmin(false); + ReplicationSlotsComputeRequiredLSN(); + } Is this calculation of resource limits really required here when the same is already done inside InvalidateObsoleteReplicationSlots() regards, Ajin Cherian Fujitsu Australia --000000000000c6d1f1061f9ca1c9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Mon, Jun 24, 2024 at 4:01=E2=80=AF= PM Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> wrote:
Hi,

On Mon, Jun 17, 2024 at 5:55=E2=80=AFPM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:

Please find the attached v41 patches implementing the idea of vacuum
doing the invalidation.

Thoughts?




Some minor comments= on the patch:
1.
+ /*
+ * Release the lock if it's not y= et to keep the cleanup path on
+ * error happy.
+ */

I s= uggest rephrasing to: " "Release the lock if it hasn't been already to ensure smooth clean= up on error."


2.

elog(DEBUG1, "performing repli= cation slot invalidation");

Probably change it to "perform= ing replication slot invalidation checks" as we might not actually inv= alidate any slot here.

3.

In CheckPointReplicationSlots()
+ invalidated =3D InvalidateObsoleteReplicationSlots(RS_INVAL_INACTIVE= _TIMEOUT,
+ 0,
+ InvalidOid,
+ = InvalidTransactionId);
+
+ if (invalidated)
+ {
+ /*
+ = * If any slots have been invalidated, recalculate the resource
+ * l= imits.
+ */
+ ReplicationSlotsComputeRequiredXmin(false);
+ Re= plicationSlotsComputeRequiredLSN();
+ }

Is this calculation of re= source limits really required here when the same is already done inside Inv= alidateObsoleteReplicationSlots()


regards,
= Ajin Cherian
Fujitsu Australia



<= /div>
--000000000000c6d1f1061f9ca1c9--