Re: Suppressing useless wakeups in walreceiver - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Suppressing useless wakeups in walreceiver
Date
Msg-id 20221004175755.GA777541@nathanxps13
Whole thread Raw
In response to Re: Suppressing useless wakeups in walreceiver  (Nathan Bossart <nathandbossart@gmail.com>)
List pgsql-hackers
Here is an updated patch set with the following changes:

* The creation of the struct for non-shared WAL receiver state is moved to
a prerequisite 0001 patch.  This should help ease review of 0002 a bit.

* I updated the nap time calculation to round up to the next millisecond,
as discussed upthread.

* I attempted to minimize the calls to GetCurrentTimestamp().  The WAL
receiver code already calls this function pretty liberally, so I don't know
if this is important, but perhaps it could make a difference for systems
that don't have something like the vDSO to avoid real system calls.

* I removed the 'tli' argument from functions that now have an argument for
the non-shared state struct.  The 'tli' is stored within the struct, so the
extra argument is unnecessary.

One thing that still bugs me a little bit about 0002 is that the calls to
GetCurrentTimestamp() feel a bit scattered and more difficult to reason
about.  AFAICT 0002 keeps 'now' relatively up-to-date, but it seems
possible that a future change could easily disrupt that.  I don't have any
other ideas at the moment, though.

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

Attachment

pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: New strategies for freezing, advancing relfrozenxid early
Next
From: Tom Lane
Date:
Subject: Re: Can we avoid chdir'ing in resolve_symlinks() ?