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 20230126202301.GA1703463@nathanxps13
Whole thread Raw
In response to Re: suppressing useless wakeups in logical/worker.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: suppressing useless wakeups in logical/worker.c
List pgsql-hackers
On Thu, Jan 26, 2023 at 03:04:30PM -0500, Tom Lane wrote:
> Nathan Bossart <nathandbossart@gmail.com> writes:
>> I wonder if we should explicitly reject negative timestamps to eliminate
>> any chance of int64 overflow, too.
> 
> Hmm.  I'm disinclined to add an assumption that the epoch is in the past,
> but I take your point that the subtraction would overflow with
> TIMESTAMP_INFINITY and a negative finite timestamp.  Maybe we should
> make use of pg_sub_s64_overflow()?

That would be my vote.  I think the 'diff <= 0' check might need to be
replaced with something like 'start_time > stop_time' so that we return 0
for the underflow case.

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



pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: Something is wrong with wal_compression
Next
From: Reid Thompson
Date:
Subject: Re: Add the ability to limit the amount of memory that can be allocated to backends.