Skip to content

Commit 9500d8f

Browse files
committed
Fix processing of PGC_BACKEND GUC parameters on Windows.
EXEC_BACKEND builds (i.e., Windows) failed to absorb values of PGC_BACKEND parameters if they'd been changed post-startup via the config file. This for example prevented log_connections from working if it were turned on post-startup. The mechanism for handling this case has always been a bit of a kluge, and it wasn't revisited when we implemented EXEC_BACKEND. While in a normal forking environment new backends will inherit the postmaster's value of such settings, EXEC_BACKEND backends have to read the settings from the CONFIG_EXEC_PARAMS file, and they were mistakenly rejecting them. So this case has always been broken in the Windows port; so back-patch to all supported branches. Amit Kapila
1 parent 6340565 commit 9500d8f

File tree

1 file changed

+20
-0
lines changed
  • src/backend/utils/misc

1 file changed

+20
-0
lines changed

src/backend/utils/misc/guc.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4778,9 +4778,23 @@ set_config_option(const char *name, const char *value,
47784778
* ignore it in existing backends. This is a tad klugy, but
47794779
* necessary because we don't re-read the config file during
47804780
* backend start.
4781+
*
4782+
* In EXEC_BACKEND builds, this works differently: we load all
4783+
* nondefault settings from the CONFIG_EXEC_PARAMS file during
4784+
* backend start. In that case we must accept PGC_SIGHUP
4785+
* settings, so as to have the same value as if we'd forked
4786+
* from the postmaster. We detect this situation by checking
4787+
* IsInitProcessingMode, which is a bit ugly, but it doesn't
4788+
* seem worth passing down an explicit flag saying we're doing
4789+
* read_nondefault_variables().
47814790
*/
4791+
#ifdef EXEC_BACKEND
4792+
if (IsUnderPostmaster && !IsInitProcessingMode())
4793+
return true;
4794+
#else
47824795
if (IsUnderPostmaster)
47834796
return true;
4797+
#endif
47844798
}
47854799
else if (context != PGC_POSTMASTER && context != PGC_BACKEND &&
47864800
source != PGC_S_CLIENT)
@@ -7136,6 +7150,12 @@ read_nondefault_variables(void)
71367150
int varsourceline;
71377151
GucSource varsource;
71387152

7153+
/*
7154+
* Assert that PGC_BACKEND case in set_config_option() will do the right
7155+
* thing.
7156+
*/
7157+
Assert(IsInitProcessingMode());
7158+
71397159
/*
71407160
* Open file
71417161
*/

0 commit comments

Comments
 (0)