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 1uY4UX-000kjX-7j for pgsql-bugs@arkaria.postgresql.org; Sat, 05 Jul 2025 15:07:49 +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 1uY4UT-006oDq-Vt for pgsql-bugs@arkaria.postgresql.org; Sat, 05 Jul 2025 15:07:46 +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 1uY4UT-006oDi-NM for pgsql-bugs@lists.postgresql.org; Sat, 05 Jul 2025 15:07:46 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uY4UQ-005uJP-2v for pgsql-bugs@lists.postgresql.org; Sat, 05 Jul 2025 15:07:44 +0000 Received: from [192.168.11.9] (p1696134-ipoe.ipoe.ocn.ne.jp [118.0.93.133]) by oss.nttdata.com (Postfix) with ESMTPSA id BFA7D61B8F; Sun, 6 Jul 2025 00:07:38 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: <3955f001-d66c-4899-a316-5f87f7ef9ecd@oss.nttdata.com> Date: Sun, 6 Jul 2025 00:07:38 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Unexpected behavior when setting "idle_replication_slot_timeout" Content-Language: en-US To: "David G. Johnston" , Laurenz Albe Cc: Amit Kapila , Nisha Moond , Gunnar Morling , pgsql-bugs@lists.postgresql.org References: <30e91649-06dd-453e-8658-5f4acd03a3bd@oss.nttdata.com> <686577f2379e4b978803e72746dcf0dd7baf3937.camel@cybertec.at> <3422d282fd45e460b4ce1bd0745523ba63bd3848.camel@cybertec.at> From: Fujii Masao In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025/07/05 15:16, David G. Johnston wrote: > On Fri, Jul 4, 2025 at 10:35 PM Laurenz Albe > wrote: > > On the other hand, if the behavior is clearly documented, as I have > tried to do with my patch, it should be fine.  So I'll rest my case if > you apply my patch. > > > We should clearly document how rounding works in section 19.1.1 (which we mostly do; "If the parameter is of integer type, a final rounding to integer occurs after any unit conversion.") and not in every time-related setting that chooses to use something larger than microseconds.  So, 30s is 'unit converted' up to 0.5 minutes (not explicitly explained...) then rounded to zero (which is odd, half normally rounds up...). This happens because in this case rounding is done using rint(3), which uses banker's rounding by default. While the rint(3)'s rounding method can be changed with fesetround(), PostgreSQL doesn't seem to change it. So 0.5 rounds to 0, 1.5 and 2.5 round to 2, 3.5 and 4.5 round to 4, and so on. Regards, -- Fujii Masao NTT DATA Japan Corporation