Re: Suppressing useless wakeups in walreceiver

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Suppressing useless wakeups in walreceiver
Date: 2022-10-04 17:57:55
Message-ID: 20221004175755.GA777541@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
v3-0001-Move-WAL-receivers-non-shared-state-to-a-new-stru.patch text/x-diff 6.4 KB
v3-0002-Suppress-useless-wakeups-in-walreceiver.patch text/x-diff 18.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-10-04 18:07:13 Re: Can we avoid chdir'ing in resolve_symlinks() ?
Previous Message Jeff Davis 2022-10-04 17:39:31 Re: New strategies for freezing, advancing relfrozenxid early