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 1tS7vZ-00EF2R-45 for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Dec 2024 05:02:53 +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 1tS7vX-009wRC-UY for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Dec 2024 05:02:51 +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 1tS7vX-009wR4-Ku for pgsql-hackers@lists.postgresql.org; Mon, 30 Dec 2024 05:02:51 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tS7vU-002IKi-8g for pgsql-hackers@lists.postgresql.org; Mon, 30 Dec 2024 05:02:50 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-3002c324e7eso102627911fa.3 for ; Sun, 29 Dec 2024 21:02:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735534967; x=1736139767; 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=mY4xqwess1Ad/oLqn1yvx97R7gDiHdTL8lanwSzjIzk=; b=JQBs1eS5xIaDGjWCSBTgn/jT1ZrxYCl8HwtM060r1KTXBdsCe+kyqnD8Bsgzr8DBrt 6BkoMrrWvNbHA920YlQEhkmDtrjoTMBkyM/D/PwRaC+NYxonBgZgS/YKnqBjLgaEj4Ky o5QGDwpSUIH/vW2SqWul7+CeJWWp7Fqw1Kr5ZsSNwDo7R9t7uyKHf3wAHim+8Xk20iRs QcFAkdn9WwItF4Wf11eMs/Ot0DklCG3g3y6oOZp9wfRStow4DTK18nDcF/jWldtcvm93 DoyqDKGVnrT5lESxiZ1AjeJ+rzPBBniqJO/BqU3spAsvuAVQiFlul4gHj+99CFWOaaYe JdQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735534967; x=1736139767; 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=mY4xqwess1Ad/oLqn1yvx97R7gDiHdTL8lanwSzjIzk=; b=b4CPTR7eWKHh1qqstLRZ37fj+5824GH9TGFZVPPe8q/cAUG0GVN7LvKGunVrnAnwzb w4aE/AdXj6Hj+H+C8lfEDPJes3bQ1qqeHp8l/hC1gRBRGO4ClYZxS/Ps75oBd+xz5gJo GG3j7Maphe6lVMJypmNzZtIxSR0kDR/b81fo7cO4N5RtbOlwYz/ewGubJFgX3w3joNAv ZLIgXgC6y+GevMPt4vEIxCo+7lg+W5NM1Knt885JoohBrg6yS1GD84ooXEj+7UzuaIGQ PPNa/xi1B+1jgutMCYpor2DcVFkTbakj5Q4eDrF5LYORp9wRh4J5kjPxmLM3h1Dl4B5o GMvA== X-Forwarded-Encrypted: i=1; AJvYcCVhV+Ux5RxYZ6zj1p/MkYxKxfJofbQMRaNQdeOnbNRaLHhHF+yMSj9LbxbeApXeDgArG/pdUJ5s/txTNcxM@lists.postgresql.org X-Gm-Message-State: AOJu0YxzeZxFcWUEiXyj3JVMOFxq0gmhZLuX6qdX2M9garoU+1NcFAxy VwYHy89SUTIty1qnehNFYtjA2kO2+n4mvFhLA0LKvukuT5/POdiLpn6e/nENHrtTboWIqCnD3nD Dn74Xy+33XXaPcAaTyPhLOxxQbEw= X-Gm-Gg: ASbGncuzACGLCWvDq61IBsORdmc3VmMskfXzd+K2Nsl4fnx+q9G/vBrh14Nn09E6yg5 ZSwisPlM4DsDRcCIS6y4ET3Jg/HqyM4X+8smEVQ== X-Google-Smtp-Source: AGHT+IGBg5wFPdl4nwsQtFM+p0jTpbmPYPlbwOcdRJLhdg1xIOA9POuzCcCeq2eH9ipU3/v5s9Fz7/AQ17Xeu1Oq6Gs= X-Received: by 2002:a2e:bea4:0:b0:300:160f:7c76 with SMTP id 38308e7fff4ca-304685f7483mr119765071fa.25.1735534967127; Sun, 29 Dec 2024 21:02:47 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Peter Smith Date: Mon, 30 Dec 2024 16:02:19 +1100 Message-ID: Subject: Re: Introduce XID age and inactive timeout based replication slot invalidation To: Nisha Moond Cc: Amit Kapila , vignesh C , "Hayato Kuroda (Fujitsu)" , shveta malik , Bharath Rupireddy , Ajin Cherian , Bertrand Drouvot , Masahiko Sawada , Nathan Bossart , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Nisha, Here are some review comments for the patch v57-0001. ====== src/backend/replication/slot.c 1. +/* + * Invalidate replication slots that have remained idle longer than this + * duration; '0' disables it. + */ +int idle_replication_slot_timeout_min = HOURS_PER_DAY * MINS_PER_HOUR; IMO it would be better to have the suffix "_mins" instead of "_min" here to avoid any confusion with "minimum". ~~~ 2. +/* + * Can invalidate an idle replication slot? + * Not an English sentence. ====== src/backend/utils/adt/timestamp.c 3. + /* Return if the difference meets or exceeds the threshold */ + return (secs >= threshold_sec); That comment may not be necessary; it is saying just the same as the code. ====== src/backend/utils/misc/guc_tables.c 4. + { + {"idle_replication_slot_timeout", PGC_SIGHUP, REPLICATION_SENDING, + gettext_noop("Sets the duration a replication slot can remain idle before " + "it is invalidated."), + NULL, + GUC_UNIT_MIN + }, + &idle_replication_slot_timeout_min, + HOURS_PER_DAY * MINS_PER_HOUR, 0, INT_MAX / SECS_PER_MINUTE, + check_idle_replication_slot_timeout, NULL, NULL + }, + Maybe it's better to include a comment that says "24 hours". (e.g. like wal_summary_keep_time does) ====== src/backend/utils/misc/postgresql.conf.sample 5. #track_commit_timestamp = off # collect timestamp of transaction commit # (change requires restart) +#idle_replication_slot_timeout = 1d # in minutes; 0 disables I felt it might be better to say 24h here instead of 1d. And, that would also be consistent with the docs, which said the default was 24 hours. ====== Kind Regards, Peter Smith. Fujitsu Australia