pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add assertion check for WAL receiver state during stream-archive
Date: Tue, 04 Nov 2025 04:29:52 +0000
Message-ID: <E1vG8g4-004vyv-2D@gemulon.postgresql.org> (raw)

Add assertion check for WAL receiver state during stream-archive transition

When the startup process switches from streaming to archive as WAL
source, we avoid calling ShutdownWalRcv() if the WAL receiver is not
streaming, based on WalRcvStreaming().  WALRCV_STOPPING is a state set
by ShutdownWalRcv(), called only by the startup process, meaning that it
should not be possible to reach this state while in
WaitForWALToBecomeAvailable().

This commit adds an assertion to make sure that a WAL receiver is never
in a WALRCV_STOPPING state should the startup process attempt to reset
InstallXLogFileSegmentActive.

Idea suggested by Noah Misch.

Author: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/19093-c4fff49a608f82a0@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/65f4976189b6cbe9aa93fc5f4b1eb7a2040b6301

Modified Files
--------------
src/backend/access/transam/xlogrecovery.c | 8 ++++++++
1 file changed, 8 insertions(+)



Message-ID: <E1vG8g4-004vyv-2D@gemulon.postgresql.org>
Permalink:  ../E1vG8g4-004vyv-2D@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vG8g4-004vyv-2D@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add assertion check for WAL receiver state during stream-archive
  In-Reply-To: <E1vG8g4-004vyv-2D@gemulon.postgresql.org>

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

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