From: Masahiko Sawada <msawada@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix assertion when decoding XLOG_PARAMETER_CHANGE on promoted pr
Date: Mon, 24 Feb 2025 22:04:19 +0000
Message-ID: <E1tmgYl-000WAe-1C@gemulon.postgresql.org> (raw)
Fix assertion when decoding XLOG_PARAMETER_CHANGE on promoted primary.
When a standby replays an XLOG_PARAMETER_CHANGE record that lowers
wal_level below logical, we invalidate all logical slots in hot
standby mode. However, if this record was replayed while not in hot
standby mode, logical slots could remain valid even after promotion,
potentially causing an assertion failure during WAL record decoding.
To fix this issue, this commit adds a check for hot_standby status
when restoring a logical replication slot on standbys. This check
ensures that logical slots are invalidated when they become
incompatible due to insufficient wal_level during recovery.
Backpatch to v16 where logical decoding on standby was introduced.
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/CAD21AoABoFwGY_Rh2aeE6tEq3HkJxf0c6UeOXn4VV9v6BAQPSw%40mail.gmail.com
Backpatch-through: 16
Branch
------
REL_17_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/174952ece1c04b725a2eafabf08d7192b99866ca
Modified Files
--------------
src/backend/replication/slot.c | 29 +++++++++++++----
.../recovery/t/035_standby_logical_decoding.pl | 38 ++++++++++++++++++++++
2 files changed, 61 insertions(+), 6 deletions(-)
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: msawada@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix assertion when decoding XLOG_PARAMETER_CHANGE on promoted pr
In-Reply-To: <E1tmgYl-000WAe-1C@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