From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
---|---|
To: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
Cc: | alvherre(at)alvh(dot)no-ip(dot)org, bharath(dot)rupireddyforpostgres(at)gmail(dot)com, thomas(dot)munro(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Suppressing useless wakeups in walreceiver |
Date: | 2022-11-05 22:00:55 |
Message-ID: | 20221105220055.GD137360@nathanxps13 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Oct 17, 2022 at 03:21:18PM +0900, Kyotaro Horiguchi wrote:
> Now that I see the fix for the implicit conversion:
>
> L527: + nap = Max(0, (nextWakeup - now + 999) / 1000);
> ..
> L545: + (int) Min(INT_MAX, nap),
>
>
> I think limiting the naptime at use is confusing. Don't we place these
> adjacently? Then we could change the nap to an integer. Or we can
> just assert out for the nap time longer than INT_MAX (but this would
> require another int64 variable. I belive we won't need such a long
> nap, (or that is no longer a nap?)
Yeah, I guess this deserves a comment. I could also combine it easily:
nap = (int) Min(INT_MAX, Max(0, (nextWakeup - now + 999) / 1000));
We could probably just remove the WL_TIMEOUT flag and set timeout to -1
whenever "nap" is calculated to be > INT_MAX, but I didn't think it was
worth complicating the code in order to save an extra wakeup every ~25
days.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Bossart | 2022-11-05 22:11:40 | Re: Suppressing useless wakeups in walreceiver |
Previous Message | Tom Lane | 2022-11-05 21:53:31 | Re: Making Vars outer-join aware |