Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf00da6d

Browse files
committed
Allow the postmaster to accept changes in PGC_BACKEND GUC variables
from the config file, so that these changes will propagate to backendsstarted later. Already-started backends continue to ignore changesin these variables.
1 parente43d51f commitf00da6d

File tree

3 files changed

+58
-41
lines changed

3 files changed

+58
-41
lines changed

‎doc/src/sgml/runtime.sgml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.86 2001/09/3018:57:45 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.87 2001/09/3020:16:21 tgl Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -845,10 +845,11 @@ env PGOPTIONS='-c geqo=off' psql
845845
<term><varname>LOG_CONNECTIONS</varname> (<type>boolean</type>)</term>
846846
<listitem>
847847
<para>
848-
Prints a line informing about each successful connectionto
848+
Prints a line informing about each successful connectionin
849849
the server log. This is off by default, although it is
850850
probably very useful. This option can only be set at server
851-
start.
851+
start or in the <filename>postgresql.conf</filename>
852+
configuration file.
852853
</para>
853854
</listitem>
854855
</varlistentry>
@@ -1223,7 +1224,7 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
12231224
<listitem>
12241225
<para>
12251226
Sets the maximum number of simultaneously open files in each server
1226-
process. The default is 1000. The limit actually used by the code
1227+
subprocess. The default is 1000. The limit actually used by the code
12271228
is the smaller of this setting and the result of
12281229
<literal>sysconf(_SC_OPEN_MAX)</literal>.
12291230
Therefore, on systems where sysconf returns a reasonable limit,
@@ -1233,7 +1234,10 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
12331234
processes all try to open that many files. If you find yourself
12341235
seeing <quote>Too many open files</> failures, try reducing this
12351236
setting.
1236-
This option can only be set at server start.
1237+
This option can only be set at server start or in the
1238+
<filename>postgresql.conf</filename> configuration file;
1239+
if changed in the configuration file, it only affects
1240+
subsequently-started server subprocesses.
12371241
</para>
12381242
</listitem>
12391243
</varlistentry>

‎src/backend/utils/misc/guc.c

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Support for grand unified configuration scheme, including SET
55
* command, configuration file, and command line options.
66
*
7-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.54 2001/09/3018:57:45 tgl Exp $
7+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.55 2001/09/3020:16:21 tgl Exp $
88
*
99
* Copyright 2000 by PostgreSQL Global Development Group
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
@@ -704,37 +704,49 @@ set_config_option(const char *name, const char *value,
704704
* precise rules. Note that we don't want to throw errors if we're in
705705
* the SIGHUP context. In that case we just ignore the attempt.
706706
*/
707-
if (record->context==PGC_POSTMASTER&&context!=PGC_POSTMASTER)
707+
switch (record->context)
708708
{
709-
if (context!=PGC_SIGHUP)
710-
elog(ERROR,"'%s' cannot be changed after server start",name);
711-
else
712-
return true;
713-
}
714-
elseif (record->context==PGC_SIGHUP&&context!=PGC_SIGHUP&&
715-
context!=PGC_POSTMASTER)
716-
{
717-
elog(ERROR,"'%s' cannot be changed now",name);
718-
719-
/*
720-
* Hmm, the idea of the SIGHUP context is "ought to be global, but
721-
* can be changed after postmaster start". But there's nothing
722-
* that prevents a crafty administrator from sending SIGHUP
723-
* signals to individual backends only.
724-
*/
725-
}
726-
elseif (record->context==PGC_BACKEND&&context!=PGC_BACKEND
727-
&&context!=PGC_POSTMASTER)
728-
{
729-
if (context!=PGC_SIGHUP)
730-
elog(ERROR,"'%s' cannot be set after connection start",name);
731-
else
732-
return true;
709+
casePGC_POSTMASTER:
710+
if (context==PGC_SIGHUP)
711+
return true;
712+
if (context!=PGC_POSTMASTER)
713+
elog(ERROR,"'%s' cannot be changed after server start",name);
714+
break;
715+
casePGC_SIGHUP:
716+
if (context!=PGC_SIGHUP&&context!=PGC_POSTMASTER)
717+
elog(ERROR,"'%s' cannot be changed now",name);
718+
/*
719+
* Hmm, the idea of the SIGHUP context is "ought to be global, but
720+
* can be changed after postmaster start". But there's nothing
721+
* that prevents a crafty administrator from sending SIGHUP
722+
* signals to individual backends only.
723+
*/
724+
break;
725+
casePGC_BACKEND:
726+
if (context==PGC_SIGHUP)
727+
{
728+
/*
729+
* If a PGC_BACKEND parameter is changed in the config file,
730+
* we want to accept the new value in the postmaster (whence
731+
* it will propagate to subsequently-started backends), but
732+
* ignore it in existing backends. This is a tad klugy, but
733+
* necessary because we don't re-read the config file during
734+
* backend start.
735+
*/
736+
if (IsUnderPostmaster)
737+
return true;
738+
}
739+
elseif (context!=PGC_BACKEND&&context!=PGC_POSTMASTER)
740+
elog(ERROR,"'%s' cannot be set after connection start",name);
741+
break;
742+
casePGC_SUSET:
743+
if (context==PGC_USERSET||context==PGC_BACKEND)
744+
elog(ERROR,"permission denied");
745+
break;
746+
casePGC_USERSET:
747+
/* always okay */
748+
break;
733749
}
734-
elseif (record->context==PGC_SUSET&&
735-
(context==PGC_USERSET||context==PGC_BACKEND))
736-
elog(ERROR,"permission denied");
737-
738750

739751
/*
740752
* Evaluate value and set variable

‎src/include/utils/guc.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* External declarations pertaining to backend/utils/misc/guc.c and
55
* backend/utils/misc/guc-file.l
66
*
7-
* $Id: guc.h,v 1.9 2001/06/1816:14:43 momjian Exp $
7+
* $Id: guc.h,v 1.10 2001/09/30 20:16:21 tgl Exp $
88
*/
99
#ifndefGUC_H
1010
#defineGUC_H
@@ -23,11 +23,12 @@
2323
* certain point in their main loop. It's safer to wait than to read a
2424
* file asynchronously.)
2525
*
26-
* BACKEND options can only be set at postmaster startup or with the
27-
* PGOPTIONS variable from the client when the connection is
28-
* initiated. Note that you cannot change this kind of option using
29-
* the SIGHUP mechanism, that would defeat the purpose of this being
30-
* fixed for a given backend once started.
26+
* BACKEND options can only be set at postmaster startup, from the
27+
* configuration file, or with the PGOPTIONS variable from the client
28+
* when the connection is initiated. Furthermore, an already-started
29+
* backend will ignore changes to such an option in the configuration
30+
* file. The idea is that these options are fixed for a given backend
31+
* once it's started, but they can vary across backends.
3132
*
3233
* SUSET options can be set at postmaster startup, with the SIGHUP
3334
* mechanism, or from SQL if you're a superuser. These options cannot

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp