postgresql/src/include/access
Peter Eisentraut 246f136e76 Improve handling of parameter differences in physical replication
When certain parameters are changed on a physical replication primary,
this is communicated to standbys using the XLOG_PARAMETER_CHANGE WAL
record.  The standby then checks whether its own settings are at least
as big as the ones on the primary.  If not, the standby shuts down
with a fatal error.

The correspondence of settings between primary and standby is required
because those settings influence certain shared memory sizings that
are required for processing WAL records that the primary might send.
For example, if the primary sends a prepared transaction, the standby
must have had max_prepared_transaction set appropriately or it won't
be able to process those WAL records.

However, fatally shutting down the standby immediately upon receipt of
the parameter change record might be a bit of an overreaction.  The
resources related to those settings are not required immediately at
that point, and might never be required if the activity on the primary
does not exhaust all those resources.  If we just let the standby roll
on with recovery, it will eventually produce an appropriate error when
those resources are used.

So this patch relaxes this a bit.  Upon receipt of
XLOG_PARAMETER_CHANGE, we still check the settings but only issue a
warning and set a global flag if there is a problem.  Then when we
actually hit the resource issue and the flag was set, we issue another
warning message with relevant information.  At that point we pause
recovery, so a hot standby remains usable.  We also repeat the last
warning message once a minute so it is harder to miss or ignore.

Reviewed-by: Sergei Kornilov <sk@zsrv.org>
Reviewed-by: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/4ad69a4c-cc9b-0dfe-0352-8b1b0cd36c7b@2ndquadrant.com
2020-03-30 09:53:45 +02:00
..
amapi.h Introduce IndexAM fields for parallel vacuum. 2020-01-15 07:24:14 +05:30
amvalidate.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
attmap.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
attnum.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
brin.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
brin_internal.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
brin_page.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
brin_pageops.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
brin_revmap.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
brin_tuple.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
brin_xlog.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
bufmask.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
clog.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
commit_ts.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
detoast.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
genam.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
generic_xlog.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
gin.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
gin_private.h Avoid full scan of GIN indexes when possible 2020-01-18 01:11:39 +03:00
ginblock.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
ginxlog.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
gist.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
gist_private.h Revert "Skip WAL for new relfilenodes, under wal_level=minimal." 2020-03-22 09:24:09 -07:00
gistscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
gistxlog.h Revert "Skip WAL for new relfilenodes, under wal_level=minimal." 2020-03-22 09:24:09 -07:00
hash.h Move src/backend/utils/hash/hashfn.c to src/common 2020-02-27 09:25:41 +05:30
hash_xlog.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
heapam.h Revert "Skip WAL for new relfilenodes, under wal_level=minimal." 2020-03-22 09:24:09 -07:00
heapam_xlog.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
heaptoast.h tableam: New callback relation_fetch_toast_slice. 2020-01-07 14:36:38 -05:00
hio.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
htup.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
htup_details.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
itup.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
multixact.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nbtree.h Remove stray parenthesis in nbtree.h. 2020-03-10 18:03:56 -07:00
nbtxlog.h Add deduplication to nbtree. 2020-02-26 13:05:30 -08:00
parallel.h Allow vacuum command to process indexes in parallel. 2020-01-20 07:57:49 +05:30
printsimple.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
printtup.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
relation.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
reloptions.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
relscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
rewriteheap.h Revert "Skip WAL for new relfilenodes, under wal_level=minimal." 2020-03-22 09:24:09 -07:00
rmgr.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
rmgrlist.h Add deduplication to nbtree. 2020-02-26 13:05:30 -08:00
sdir.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
session.h Fix typo. 2020-01-13 14:44:55 +05:30
skey.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
slru.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
spgist.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
spgist_private.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
spgxlog.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
stratnum.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
subtrans.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
sysattr.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
table.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tableam.h Revert "Skip WAL for new relfilenodes, under wal_level=minimal." 2020-03-22 09:24:09 -07:00
timeline.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
toast_helper.h Introduce macros for typalign and typstorage constants. 2020-03-04 10:34:25 -05:00
toast_internals.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
transam.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tsmapi.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tupconvert.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tupdesc.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tupdesc_details.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tupmacs.h Introduce macros for typalign and typstorage constants. 2020-03-04 10:34:25 -05:00
twophase.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
twophase_rmgr.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
valid.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
visibilitymap.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
xact.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
xlog.h Improve handling of parameter differences in physical replication 2020-03-30 09:53:45 +02:00
xlog_internal.h Add deduplication to nbtree. 2020-02-26 13:05:30 -08:00
xlogdefs.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
xloginsert.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
xlogreader.h Refactor XLogReadRecord(), adding XLogBeginRead() function. 2020-01-26 11:39:00 +02:00
xlogrecord.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
xlogutils.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00