1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

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
This commit is contained in:
Amit Kapila
2023-11-10 08:45:01 +05:30
parent 5ba1ac99a8
commit 8bfb231b43
4 changed files with 27 additions and 12 deletions

View File

@ -1424,18 +1424,12 @@ InvalidatePossiblyObsoleteSlot(ReplicationSlotInvalidationCause cause,
SpinLockRelease(&s->mutex);
/*
* The logical replication slots shouldn't be invalidated as
* max_slot_wal_keep_size GUC is set to -1 during the upgrade.
*
* The following is just a sanity check.
* The logical replication slots shouldn't be invalidated as GUC
* max_slot_wal_keep_size is set to -1 during the binary upgrade. See
* check_old_cluster_for_valid_slots() where we ensure that no
* invalidated before the upgrade.
*/
if (*invalidated && SlotIsLogical(s) && IsBinaryUpgrade)
{
ereport(ERROR,
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("replication slots must not be invalidated during the upgrade"),
errhint("\"max_slot_wal_keep_size\" must be set to -1 during the upgrade"));
}
Assert(!(*invalidated && SlotIsLogical(s) && IsBinaryUpgrade));
if (active_pid != 0)
{