aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2023-11-10 08:45:01 +0530
committerAmit Kapila <akapila@postgresql.org>2023-11-10 08:45:01 +0530
commit8bfb231b43d7f6058041483f2b823dd52eac7bf8 (patch)
tree311e53b4233a5db636bc0170d237622dabb5e3d5 /src/backend/access/transam/xlog.c
parent5ba1ac99a8d8623604d3152be8fd9a201ba5240b (diff)
downloadpostgresql-8bfb231b43d7f6058041483f2b823dd52eac7bf8.tar.gz
postgresql-8bfb231b43d7f6058041483f2b823dd52eac7bf8.zip
Prohibit max_slot_wal_keep_size to value other than -1 during upgrade.
We don't want existing slots in the old cluster to get invalidated during the upgrade. During an upgrade, we set this variable to -1 via the command line in an attempt to prevent such invalidations, but users have ways to override it. This patch ensures the value is not overridden by the user. Author: Kyotaro Horiguchi Reviewed-by: Peter Smith, Alvaro Herrera Discussion: http://postgr.es/m/20231027.115759.2206827438943188717.horikyota.ntt@gmail.com
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index b541be8eec2..1159dff1a69 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -2064,6 +2064,25 @@ check_wal_segment_size(int *newval, void **extra, GucSource source)
}
/*
+ * GUC check_hook for max_slot_wal_keep_size
+ *
+ * We don't allow the value of max_slot_wal_keep_size other than -1 during the
+ * binary upgrade. See start_postmaster() in pg_upgrade for more details.
+ */
+bool
+check_max_slot_wal_keep_size(int *newval, void **extra, GucSource source)
+{
+ if (IsBinaryUpgrade && *newval != -1)
+ {
+ GUC_check_errdetail("\"%s\" must be set to -1 during binary upgrade mode.",
+ "max_slot_wal_keep_size");
+ return false;
+ }
+
+ return true;
+}
+
+/*
* At a checkpoint, how many WAL segments to recycle as preallocated future
* XLOG segments? Returns the highest segment that should be preallocated.
*/