8000 Fix processing of PGC_BACKEND GUC parameters on Windows. · larkly/postgres-docker@30e434b · GitHub
[go: up one dir, main page]

Skip to content

Commit 30e434b

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 alwa 8000 ys 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 129b8ad commit 30e434b

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
@@ -4625,9 +4625,23 @@ set_config_option(const char *name, const char *value,
46254625
* ignore it in existing backends. This is a tad klugy, but
46264626
* necessary because we don't re-read the config file during
46274627
* backend start.
4628+
*
4629+
* In EXEC_BACKEND builds, this works differently: we load all
4630+
* nondefault settings from the CONFIG_EXEC_PARAMS file during
4631+
* backend start. In that case we must accept PGC_SIGHUP
4632+
* settings, so as to have the same value as if we'd forked
4633+
* from the postmaster. We detect this situation by checking
4634+
* IsInitProcessingMode, which is a bit ugly, but it doesn't
4635+
* seem worth passing down an explicit flag saying we're doing
4636+
* read_nondefault_variables().
46284637
*/
4638+
#ifdef EXEC_BACKEND
4639+
if (IsUnderPostmaster && !IsInitProcessingMode())
4640+
return true;
4641+
#else
46294642
if (IsUnderPostmaster)
46304643
return true;
4644+
#endif
46314645
}
46324646
else if (context != PGC_BACKEND && context != PGC_POSTMASTER)
46334647
{
@@ -6918,6 +6932,12 @@ read_nondefault_variables(void)
69186932
int varsourceline;
69196933
GucSource varsource;
69206934

6935+
/*
6936+
* Assert that PGC_BACKEND case in set_config_option() will do the right
6937+
* thing.
6938+
*/
6939+
Assert(IsInitProcessingMode());
6940+
69216941
/*
69226942
* Open file
69236943
*/

0 commit comments

Comments
 (0)
0