pgsql: Fix synchronized_standby_slots GUC check hook

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix synchronized_standby_slots GUC check hook
Date: 2024-12-03 16:51:41
Message-ID: E1tIW7h-000vve-34@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix synchronized_standby_slots GUC check hook

The validate_sync_standby_slots subroutine requires an LWLock, so it
cannot run in processes without PGPROC; skip it there to avoid a crash.

This replaces the current test for ReplicationSlotCtl being not null,
which appears to be a solution for the same problem but less general.
I also rewrote a related comment that mentioned ReplicationSlotCtl in
StandbySlotsHaveCaughtup.

This code came in with commit bf279ddd1c28; backpatch to 17.

Reported-by: Gabriele Bartolini <gabriele(dot)bartolini(at)enterprisedb(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Reviewed-by: Zhijie Hou <houzj(dot)fnst(at)fujitsu(dot)com>
Discussion: https://postgr.es/m/202411281216.sutbxtr6idnn@alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3c5f9f12c807760f6d512957a863113b07a79dcb

Modified Files
--------------
src/backend/replication/slot.c | 44 ++++++++++++++++--------------------------
1 file changed, 17 insertions(+), 27 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2024-12-03 17:44:48 pgsql: Define _POSIX_C_SOURCE as 200112L on Solaris.
Previous Message Tom Lane 2024-12-03 16:20:32 Re: pgsql: Avoid mislabeling of lateral references when pulling up a subque