Skip to content

Commit cb11f4d

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 af7738f commit cb11f4d

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
@@ -5191,9 +5191,23 @@ set_config_option(const char *name, const char *value,
51915191
* ignore it in existing backends. This is a tad klugy, but
51925192
* necessary because we don't re-read the config file during
51935193
* backend start.
5194+
*
5195+
* In EXEC_BACKEND builds, this works differently: we load all
5196+
* nondefault settings from the CONFIG_EXEC_PARAMS file during
5197+
* backend start. In that case we must accept PGC_SIGHUP
5198+
* settings, so as to have the same value as if we'd forked
5199+
* from the postmaster. We detect this situation by checking
5200+
* IsInitProcessingMode, which is a bit ugly, but it doesn't
5201+
* seem worth passing down an explicit flag saying we're doing
5202+
* read_nondefault_variables().
51945203
*/
5204+
#ifdef EXEC_BACKEND
5205+
if (IsUnderPostmaster && !IsInitProcessingMode())
5206+
return true;
5207+
#else
51955208
if (IsUnderPostmaster)
51965209
return true;
5210+
#endif
51975211
}
51985212
else if (context != PGC_POSTMASTER && context != PGC_BACKEND &&
51995213
source != PGC_S_CLIENT)
@@ -7514,6 +7528,12 @@ read_nondefault_variables(void)
75147528
int varsourceline;
75157529
GucSource varsource;
75167530

7531+
/*
7532+
* Assert that PGC_BACKEND case in set_config_option() will do the right
7533+
* thing.
7534+
*/
7535+
Assert(IsInitProcessingMode());
7536+
75177537
/*
75187538
* Open file
75197539
*/

0 commit comments

Comments
 (0)