Re: Unexpected behavior when setting "idle_replication_slot_timeout" - Mailing list pgsql-bugs

From Fujii Masao
Subject Re: Unexpected behavior when setting "idle_replication_slot_timeout"
Date
Msg-id 3955f001-d66c-4899-a316-5f87f7ef9ecd@oss.nttdata.com
Whole thread Raw
In response to Re: Unexpected behavior when setting "idle_replication_slot_timeout"  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Unexpected behavior when setting "idle_replication_slot_timeout"
List pgsql-bugs

On 2025/07/05 15:16, David G. Johnston wrote:
> On Fri, Jul 4, 2025 at 10:35 PM Laurenz Albe <laurenz.albe@cybertec.at <mailto:laurenz.albe@cybertec.at>> 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
touse something larger than microseconds.  So, 30s is 'unit converted' up to 0.5 minutes (not explicitly explained...)
thenrounded 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




pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: functional index search path issue.
Next
From: "David G. Johnston"
Date:
Subject: Re: Unexpected behavior when setting "idle_replication_slot_timeout"