public inbox for [email protected]  
help / color / mirror / Atom feed
From: Daniel Gustafsson <[email protected]>
To: [email protected]
Subject: pgsql: Fix checksum state transition during promotion
Date: Fri, 29 May 2026 19:29:12 +0000
Message-ID: <[email protected]> (raw)

Fix checksum state transition during promotion

When a standby is promoted to primary during checksum enabling when the
state is inprogress-on, the standby shall revert the state to off since
checksums weren't fully enabled at the time of the crash.  Consider the
following scenario:

  1) primary/standby cluster has checksums off
  2) primary starts enabling checksums
  3) primary moves to inprogress-on
  4) standby receives that and moves to inprogress-on too
  5) primary crashes
  6) standby gets promoted, and does the StartupXLOG thing
  7) standby moves from inprogress-on back to off

Any processes in the standby need to be informed at step 6 to change
state with a procsignalbarrier, else they will stay in inprogress-on
while new backends will see the state as off.  StartupXLOG failed to
emit a procsignalbarrier which caused inconsistent state in the node
promoted to primary.

Fixed by emitting a procsignalbarrier during promotion, and adding a
new test for this scenario.

Author: Daniel Gustafsson <[email protected]>
Reported-by: Tomas Vondra <[email protected]>
Discussion: https://postgr.es/m/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5fee7cab1b8746c9e1bc25b20158cb074c7a76da

Modified Files
--------------
src/backend/access/transam/xlog.c                  |  5 +-
.../test_checksums/t/003_standby_restarts.pl       | 58 ++++++++++++++++++++++
2 files changed, 62 insertions(+), 1 deletion(-)



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: Fix checksum state transition during promotion
  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