From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Subject: pg_settings.pending_restart not set when line removed
Date: Mon, 26 Jul 2021 19:02:12 -0400
Message-ID: <202107262302.xsfdfc5sb7sh@alvherre.pgsql> (raw)
Hi
I got a report from Gabriele Bartolini and team that the pg_settings
view does not get the pending_restart flag set when a setting's line is
removed from a file (as opposed to its value changed).
The explanation seems to be that GUC_PENDING_RESTART is set by
set_config_option, but when ProcessConfigFileInternal is called only to
provide data (applySettings=true), then set_config_option is never
called and thus the flag doesn't get set.
I tried the attached patch, which sets GUC_PENDING_RESTART if we're
doing pg_file_settings(). Then any subsequent read of pg_settings will
have the pending_restart flag set. This seems to work correctly, and
consistently with the case where you change a line (without removing it)
in unpatched master.
You could argue that this is *weird* (why does reading pg_file_settings
set a flag in global state?) ... but that weirdness is not something
this patch is introducing.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"Hay dos momentos en la vida de un hombre en los que no debería
especular: cuando puede permitírselo y cuando no puede" (Mark Twain)
Attachments:0001-fix-guc.patch (text/x-diff, 720B) download
From 71fa384a6bf7aef58bdbe6d382cbc1219dbaa420 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Mon, 26 Jul 2021 18:35:09 -0400
Subject: [PATCH] fix guc
---
src/backend/utils/misc/guc-file.l | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/backend/utils/misc/guc-file.l b/src/backend/utils/misc/guc-file.lindex 986ce542e3..1fe3af6284 100644--- a/src/backend/utils/misc/guc-file.l+++ b/src/backend/utils/misc/guc-file.l@@ -354,6 +354,7 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
gconf->name),
NULL, 0,
&head, &tail);
+ gconf->status |= GUC_PENDING_RESTART;
error = true;
continue;
}
--
2.20.1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, pgsql-hackers@lists.postgresql.org
Subject: Re: pg_settings.pending_restart not set when line removed
In-Reply-To: <202107262302.xsfdfc5sb7sh@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox