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 1tImb9-00GZ1T-ET for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Dec 2024 10:27:11 +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 1tImb6-00GKot-T2 for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Dec 2024 10:27:10 +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 1tImb6-00GKoN-JL for pgsql-hackers@lists.postgresql.org; Wed, 04 Dec 2024 10:27:09 +0000 Received: from mail-yb1-xb36.google.com ([2607:f8b0:4864:20::b36]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tImb5-000zMh-4h for pgsql-hackers@lists.postgresql.org; Wed, 04 Dec 2024 10:27:08 +0000 Received: by mail-yb1-xb36.google.com with SMTP id 3f1490d57ef6-e398dc7864dso4658373276.3 for ; Wed, 04 Dec 2024 02:27:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733308025; x=1733912825; darn=lists.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=DxRbgLBRNzGTWt045D7qAsIhiLEay+DPzw52RKsrIk4=; b=ApVwQZyIvArwhGzThtTG5V2gf/m4PfdDjtg3oYwhEazsr9/dXIw+/k3QEPsW3x2Kdn mFYNtWmAbZf8JNnvKjhp+47/OISDKdVvkL/TZgXSUFstF2S3xQ4/BGfJqpfLmf7hfs+i mXr36yRU6HAtzmP8r3UjtC89qk+JQiHks+cUIPkHoSnnAV03Y1oBa1qN5oMuPx5UuRsQ F3fJVtwh0x+UqdhxjGwLqU501by+kWMyMOQ6/aj2cqRM6uf79M9eD3uMDje5n5bbnBsf B1daaPbQdXtycGbe4L10ADDmYgFQk8Plyv4sEGebUbl6AS+Aobyh+02IxKwRRZMhVaE2 0ECQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733308025; x=1733912825; 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=DxRbgLBRNzGTWt045D7qAsIhiLEay+DPzw52RKsrIk4=; b=otLkKz+yXtxcwYtPEAS5YjDpTGHzK/ze3TKllEKYuJDasDBT4joBaLk1Sk1L9xSQ75 z1ddSekXHf4fkcZu9DeRwzq5sM+1vFeYv7cRwe52aUDvbVU+ZtTOKwMRRCdr/ZTJJLN5 NhLx6Kxtakg2ObedxHBkoIp9JtXsXHaBjU3cMv28U9CnIgNHOcUfE/sXTJQNUjEXqi1H 269dc2IjoE8msL0IlOhalWZgS2JL+yeTS0Ph8EAO4XRykXLFRmJJz7vr1OX3X7Zeo/hR tNi+zuAzWUnvvDvO+tZgR6oY8IG9COP81/m3FZ6AlOJUllD31SjphPSc6lZojaZgRFIr TKhw== X-Forwarded-Encrypted: i=1; AJvYcCXB6eSvuGnWuat9h2sxf/eSzumlKbxymruYCD69GW/a7IRCuXkiSVoHWQ0mImVSszYbkRXkJf3IZL08MYeF@lists.postgresql.org X-Gm-Message-State: AOJu0YwW9+GnvOXZUDsWJ93pKc3EbKq+0dg0EVjYqKQLXDiW5AaXrHHt 36AZByqz4hx13ZXcgXuRN+t0FkmykrcpC+HQAGz++CfdNg4sMQc061QFEs/BIugiT+h9h3nZ7+W 59JdPEWjSMKd/GqjZUu09nTce0F0= X-Gm-Gg: ASbGncsxN2Q9dwwhrXTpF5HpJzDiAcKRI7MIiAN2vKlJPmo9Tr/6+kHVENTqFZKbU65 AYJwASTTDVxI1RU8+T3dKxlZihIMos4k= X-Google-Smtp-Source: AGHT+IG75I8beB01iZj1oHnMzyGBLVVS2oh1CnIYji5ex+7IjSdZ04Y8/Ae3DS5WDEOkp9YHcZCb4fgGMqWU0dlJQm4= X-Received: by 2002:a05:6902:250d:b0:e39:7fe5:3b5e with SMTP id 3f1490d57ef6-e39d438c154mr5812359276.53.1733308025434; Wed, 04 Dec 2024 02:27:05 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: vignesh C Date: Wed, 4 Dec 2024 15:56:53 +0530 Message-ID: Subject: Re: Introduce XID age and inactive timeout based replication slot invalidation To: Nisha Moond Cc: "Hayato Kuroda (Fujitsu)" , shveta malik , Bharath Rupireddy , Peter Smith , Amit Kapila , Ajin Cherian , Bertrand Drouvot , Masahiko Sawada , Nathan Bossart , PostgreSQL Hackers 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 Wed, 4 Dec 2024 at 15:01, Nisha Moond wrote: > > On Tue, Dec 3, 2024 at 1:09=E2=80=AFPM Hayato Kuroda (Fujitsu) > wrote: > > > > Dear Nisha, > > > > Thanks for updating the patch! > > > > > Fixed. It is reasonable to align with other timeout parameters by > > > using milliseconds as the unit. > > > > It looks you just replaced to GUC_UNIT_MS, but the documentation and > > postgresql.conf.sample has not been changed yet. They should follow cod= es. > > Anyway, here are other comments, mostly cosmetic. > > > > Here is v53 patch-set addressing all the comments in [1] and [2]. Currently, replication slots are invalidated based on the replication_slot_inactive_timeout only during a checkpoint. This means that if the checkpoint_timeout is set to a higher value than the replication_slot_inactive_timeout, slot invalidation will occur only when the checkpoint is triggered. Identifying the invalidation slots might be slightly delayed in this case. As an alternative, users can forcefully invalidate inactive slots that have exceeded the replication_slot_inactive_timeout by forcing a checkpoint. I was thinking we could suggest this in the documentation. + + Slot invalidation due to inactive timeout occurs during checkpoint= . + The duration of slot inactivity is calculated using the slot's + pg_replication_slots.inactive_since + value. + + We could accurately invalidate the slots using the checkpointer process by calculating the invalidation time based on the active_since timestamp and the replication_slot_inactive_timeout, and then set the checkpointer's main wait-latch accordingly for triggering the next checkpoint. Ideally, a different process handling this task would be better, but there is currently no dedicated daemon capable of identifying and managing slots across streaming replication, logical replication, and other slots used by plugins. Additionally, overloading the checkpointer with this responsibility may not be ideal. As an alternative, we could document about this delay in identifying and mention that it could be triggered by forceful manual checkpoint. Regards, Vignesh