postgresql/src/backend/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
..
brin Remove utils/acl.h from catalog/objectaddress.h 2020-03-10 10:27:00 +01:00
common Trigger autovacuum based on number of INSERTs 2020-03-28 19:20:12 +13:00
gin Simplify/speed up assertion cross-check in ginCompressPostingList(). 2020-03-07 13:31:17 -05:00
gist Revert "Skip WAL for new relfilenodes, under wal_level=minimal." 2020-03-22 09:24:09 -07:00
hash Move src/backend/utils/hash/hashfn.c to src/common 2020-02-27 09:25:41 +05:30
heap Introduce vacuum errcontext to display additional information. 2020-03-30 07:33:38 +05:30
index Add deduplication to nbtree. 2020-02-26 13:05:30 -08:00
nbtree Make deduplication use number of key attributes. 2020-03-28 20:25:03 -07:00
rmgrdesc Revert "Skip WAL for new relfilenodes, under wal_level=minimal." 2020-03-22 09:24:09 -07:00
spgist Clean up newlines following left parentheses 2020-01-30 13:42:14 -03:00
table Introduce macros for typalign and typstorage constants. 2020-03-04 10:34:25 -05:00
tablesample Move src/backend/utils/hash/hashfn.c to src/common 2020-02-27 09:25:41 +05:30
transam Improve handling of parameter differences in physical replication 2020-03-30 09:53:45 +02:00
Makefile Introduce access/{table.h, relation.h}, for generic functions from heapam.h. 2019-01-21 10:51:36 -08:00