postgresql/src
Masahiko Sawada 48796a98d5 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
2025-02-24 14:03:04 -08:00
..
backend Fix assertion when decoding XLOG_PARAMETER_CHANGE on promoted primary. 2025-02-24 14:03:04 -08:00
bin pg_amcheck: PQclear query results 2025-02-24 16:03:19 +01:00
common Remove various unnecessary (char *) casts 2025-02-20 19:49:27 +01:00
fe_utils In fmtIdEnc(), handle failure of enlargePQExpBuffer(). 2025-02-16 12:46:35 -05:00
include Delay extraction of TIDBitmap per page offsets 2025-02-24 16:10:19 -05:00
interfaces oauth: Rename macro to avoid collisions on Windows 2025-02-24 22:20:37 +01:00
makefiles Add support for OAUTHBEARER SASL mechanism 2025-02-20 16:25:17 +01:00
pl Allow extension functions to participate in in-place updates. 2025-02-11 12:49:34 -05:00
port Avoid breaking SJIS encoding while de-backslashing Windows paths. 2025-01-29 14:24:36 -05:00
template thread-safety: gmtime_r(), localtime_r() 2024-08-23 07:43:04 +02:00
test Fix assertion when decoding XLOG_PARAMETER_CHANGE on promoted primary. 2025-02-24 14:03:04 -08:00
timezone Update time zone data files to tzdata release 2025a. 2025-01-20 16:49:15 -05:00
tools Remove read/sync fields from pg_stat_wal and GUC track_wal_io_timing 2025-02-24 09:51:56 +09:00
tutorial Doc: simplify the tutorial's window-function examples. 2025-01-21 14:43:21 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Add support for OAUTHBEARER SASL mechanism 2025-02-20 16:25:17 +01:00
Makefile.shlib Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00