From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> |
Cc: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Gunnar Morling <gunnar(dot)morling(at)googlemail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Unexpected behavior when setting "idle_replication_slot_timeout" |
Date: | 2025-07-05 15:12:01 |
Message-ID: | CAKFQuwbMq6U+AwrKKPE5AaCPRaed-GTiJAeRsriYWKAbDir+Mw@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Saturday, July 5, 2025, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
>
>
> On 2025/07/05 15:16, David G. Johnston wrote:
>
>> On Fri, Jul 4, 2025 at 10:35 PM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at
>> <mailto:laurenz(dot)albe(at)cybertec(dot)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 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.
>
Right, a.k.a., half-even rounding. So, not odd.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-07-05 15:56:48 | Re: Unexpected behavior when setting "idle_replication_slot_timeout" |
Previous Message | David G. Johnston | 2025-07-05 15:10:10 | Re: Unexpected behavior when setting "idle_replication_slot_timeout" |