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 1rpL5K-006EZp-6y for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Mar 2024 04:40: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 1rpL5I-009hMq-Se for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Mar 2024 04:40: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 1rpL5I-009hMi-Ja for pgsql-hackers@lists.postgresql.org; Wed, 27 Mar 2024 04:40:20 +0000 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rpL5E-006duy-L4; Wed, 27 Mar 2024 04:40:19 +0000 Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3c3aa9ca414so4012332b6e.2; Tue, 26 Mar 2024 21:40:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711514417; x=1712119217; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7o5FkRBOchyYHeZjVoBojenxpxH5cTedt5/UWjAKfT4=; b=cckJ6LRSCD4AK2ja0UY8DPKDwz2Q5hdHXp41syEVWFaj6aAVpRkSakgvyFxa+jIBJH 02UNj/lEb3F9l3k0VD67HlmnfMvo7uiQXOFnMUlXVETsV6CojEo6hJLl4MQkwz3VDXlO wJOHgaLYj2GNrtc4s+l85MFkDO4Mehsq7Dy5zftvnnMCtOITOB+4QwhhmBDtIouW+Cfq ofELpOgDgIx8iLxyt32qkhGcP+lezdGqmxaIA9g3kf3JFIgf8i45TMWXoxMHC94D4YS/ xp6MX3B6AEJy4Rs6p7TtypKaK61iPkumv5lVoBTXo4w9YjVLQlZTvuU7aKr6pWJMViSN hv0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711514417; x=1712119217; h=content-transfer-encoding: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=7o5FkRBOchyYHeZjVoBojenxpxH5cTedt5/UWjAKfT4=; b=IWA/GWv78y1ug0I70f4m5UOVxm+PKg37LhrfvNNUzGK4n2XtNT4RBe2PEiMCvR/s+J v+UngzoV42bZ7dXfbUcp+EizzcO1FFrUkZ6AWZUEwrk+ARHWFOyZpl6my2K3tlTviMQZ 9v3h7MimaqEkqFOPqiGo3zx3IWDUV9xbvshSiIkdx2mRU0TDBD5SqCUNmI6I73t5WWQn 41Aak7VzfDszBDzgxFxFQKt9+oKliKzxANQMsRbkPtoeoNTghB1JLOJO96anKaidyzJj rKE9xt02T0Cc52MnL4o1iSD17BJiDnGASWJ/KpY3N44Pr51g74oke1RrCZSCda3LV9vz L5Dg== X-Forwarded-Encrypted: i=1; AJvYcCWgrGiRzBFD63qPpIcvXFA2hVWWbLUAy8M4874kgwv8Nuvbd5EHoxaW4/OtyJn9inIy72epmg3GOfZ+fiLeniYMFXsFIxs0uhkq1znN+vepGzvONmm5R5dt1yrJGzK35kf2cvxa X-Gm-Message-State: AOJu0YzdzqqQMm0zKEGVjFl2F8j3yzarI0VccUUMKg1NmQNvnOynVqec 0PRhhesFfebzzSudznO8wbhvGvoWn8Gt7m1m47+euJXo9aCzGsps9Aeo5WM4LE3wTlbPesgismY Pa22uTi2eXBKMJ+ifKniIdNusKcQ= X-Google-Smtp-Source: AGHT+IEbHn9c48NKati4zUTHgW2fymZagrGyeBagHC3i6ujBy3Yr9h0IJWLJZqjZsfF01zu2gLUd0WUnrdFoO51ObJE= X-Received: by 2002:a05:6870:f110:b0:22a:5629:ad0 with SMTP id k16-20020a056870f11000b0022a56290ad0mr3287796oac.13.1711514416706; Tue, 26 Mar 2024 21:40:16 -0700 (PDT) MIME-Version: 1.0 References: <20240326150918.GB3181099@nathanxps13> <202403261539.xcjfle7sksz7@alvherre.pgsql> In-Reply-To: <202403261539.xcjfle7sksz7@alvherre.pgsql> From: Amit Kapila Date: Wed, 27 Mar 2024 10:10:05 +0530 Message-ID: Subject: Re: pgsql: Track last_inactive_time in pg_replication_slots. To: Alvaro Herrera Cc: Nathan Bossart , Robert Haas , Bertrand Drouvot , shveta malik , Bharath Rupireddy , Amit Kapila , "pgsql-hackers@postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Mar 26, 2024 at 9:10=E2=80=AFPM Alvaro Herrera wrote: > > On 2024-Mar-26, Nathan Bossart wrote: > > > 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. > > Yeah, I tend to agree that an XID-based limit makes more sense than a > time-based one. > So, do we want the time-based parameter or just max_slot_xid_age considering both will be GUC's? Yes, the xid_age based parameter sounds to be directly helpful for transaction ID wraparound or dead row cleanup, OTOH having a lot of inactive slots (which is possible in use cases where a tool creates a lot of slots and forgets to remove them, or the tool exits without cleaning up slots (say due to server shutdown)) also prohibit removing dead space which is not nice either? The one example that comes to mind is the pg_createsubscriber (committed for PG17) which creates one slot per database to convert standby to subscriber, now say it exits due to power shutdown then there could be a lot of dangling slots on the primary server. Also, say there is some bug in such a tool that doesn't allow proper cleanup of slots, the same problem can happen; yeah, this would be a problem of the tool but I think there is no harm in giving a way to avoid problems at the server end due to such slots. --=20 With Regards, Amit Kapila.