Re: suppressing useless wakeups in logical/worker.c

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2023-01-26T04:04:00Z
Lists: pgsql-hackers
Thomas Munro <thomas.munro@gmail.com> writes:
> On Thu, Jan 26, 2023 at 3:28 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> It'd probably be reasonable to file down that sharp edge by instead
>> specifying that TimestampDifferenceMilliseconds will clamp overflowing
>> differences to LONG_MAX.  Maybe there should be a clamp on the underflow
>> side too ... but should it be to LONG_MIN or to zero?

> That got me curious... Why did WaitLatch() use long in the first
> place?

Good question.  It's not a great choice, because of the inherent
platform specificity.  OTOH, I'm not sure it's worth the pain
to change now.

			regards, tom lane



Commits

  1. Improve TimestampDifferenceMilliseconds to cope with overflow sanely.

  2. Code review for commit 05a7be935.