Re: suppressing useless wakeups in logical/worker.c - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: suppressing useless wakeups in logical/worker.c
Date
Msg-id 20230126003319.GA1507251@nathanxps13
Whole thread Raw
In response to Re: suppressing useless wakeups in logical/worker.c  (Thomas Munro <thomas.munro@gmail.com>)
Responses Re: suppressing useless wakeups in logical/worker.c
List pgsql-hackers
On Thu, Jan 26, 2023 at 01:23:41PM +1300, Thomas Munro wrote:
> Can we also use TimestampDifferenceMilliseconds()?  It knows about
> rounding up for WaitLatch().

I think we might risk overflowing "long" when all the wakeup times are
DT_NOEND:

     * This is typically used to calculate a wait timeout for WaitLatch()
     * or a related function.  The choice of "long" as the result type
     * is to harmonize with that.  It is caller's responsibility that the
     * input timestamps not be so far apart as to risk overflow of "long"
     * (which'd happen at about 25 days on machines with 32-bit "long").

Maybe we can adjust that function or create a new one to deal with this.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: suppressing useless wakeups in logical/worker.c
Next
From: Andres Freund
Date:
Subject: Re: New strategies for freezing, advancing relfrozenxid early