public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alexander Korotkov <[email protected]>
To: [email protected]
Subject: pgsql: Remove redundant WAIT FOR LSN caller-side pre-checks
Date: Sun, 03 May 2026 13:22:22 +0000
Message-ID: <[email protected]> (raw)

Remove redundant WAIT FOR LSN caller-side pre-checks

All five wakeup call sites duplicate WaitLSNWakeup()'s internal
fast-path minWaitedLSN check and add an unnecessary NULL check
on waitLSNState.

Remove the inline pre-checks and call WaitLSNWakeup() directly.
The fast-path check inside WaitLSNWakeup() already returns early
when no waiter's target has been reached, so there is no
performance difference.

The waitLSNState NULL checks are also unnecessary: shared memory
is fully initialized before any backend or auxiliary process
starts, so waitLSNState is always non-NULL at these call sites.

Reported-by: Andres Freund <[email protected]>
Discussion: https://postgr.es/m/jzq5shdewncpxc35r3s2mcfsmo4bjovkza5mnqf5bdfumhfi3g%40bglckf7dxmw5
Author: Xuneng Zhou <[email protected]>
Reviewed-by: Andres Freund <[email protected]>
Reviewed-by: Alexander Korotkov <[email protected]>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/df9f938ca2ec30e1018a76d80ccc77c7073d7acf

Modified Files
--------------
src/backend/access/transam/xlog.c         | 16 ++++++----------
src/backend/access/transam/xlogrecovery.c | 11 ++++-------
src/backend/replication/walreceiver.c     | 17 ++++++-----------
3 files changed, 16 insertions(+), 28 deletions(-)



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: Remove redundant WAIT FOR LSN caller-side pre-checks
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox