Skip to content

Commit 2d2eec6

Browse files
committed
Back out patch that allowed commented guc variables to return to their
default values. Was causing regression failures.
1 parent 510aad3 commit 2d2eec6

File tree

3 files changed

+28
-137
lines changed

3 files changed

+28
-137
lines changed

src/backend/utils/misc/guc-file.l

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.40 2006/08/11 20:15:16 momjian Exp $
7+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.41 2006/08/12 04:11:50 momjian Exp $
88
*/
99

1010
%{
@@ -117,7 +117,6 @@ ProcessConfigFile(GucContext context)
117117
{
118118
int elevel, i;
119119
struct name_value_pair *item, *head, *tail;
120-
char *env;
121120
bool *apply_list = NULL;
122121
int varcount = 0;
123122
@@ -184,58 +183,6 @@ ProcessConfigFile(GucContext context)
184183
set_config_option(item->name, item->value, context,
185184
PGC_S_FILE, false, true);
186185
187-
if( context == PGC_SIGHUP)
188-
{
189-
/*
190-
* Revert all "untouched" options with reset source PGC_S_FILE to
191-
* default/boot value.
192-
*/
193-
for (i = 0; i < num_guc_variables; i++)
194-
{
195-
struct config_generic *gconf = guc_variables[i];
196-
if ( gconf->reset_source == PGC_S_FILE &&
197-
!(gconf->status & GUC_IN_CONFFILE) )
198-
{
199-
if ( gconf->context == PGC_BACKEND && IsUnderPostmaster)
200-
; /* Be silent. Does any body want message from each session? */
201-
else if (gconf->context == PGC_POSTMASTER)
202-
ereport(elevel,
203-
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
204-
errmsg("parameter \"%s\" cannot be changed (commented) after server start; configuration file change ignored",
205-
gconf->name)));
206-
else if(set_config_option(gconf->name,
207-
NULL, context,
208-
PGC_S_FILE,
209-
false, true))
210-
{
211-
GucStack *stack;
212-
/* set correctly source */
213-
gconf->reset_source = PGC_S_DEFAULT;
214-
for (stack = gconf->stack; stack; stack = stack->prev)
215-
if (stack->source == PGC_S_FILE)
216-
stack->source = PGC_S_DEFAULT;
217-
218-
ereport(elevel,
219-
(errcode(ERRCODE_SUCCESSFUL_COMPLETION),
220-
errmsg("configuration option %s falls back to default value", gconf->name)));
221-
}
222-
}
223-
gconf->status &= ~GUC_IN_CONFFILE;
224-
}
225-
226-
/* Revert to environment variable. PGPORT is ignored, because it cannot be
227-
* set in running state.
228-
*/
229-
env = getenv("PGDATESTYLE");
230-
if (env != NULL)
231-
set_config_option("datestyle", env, context,
232-
PGC_S_ENV_VAR, false, true);
233-
234-
env = getenv("PGCLIENTENCODING");
235-
if (env != NULL)
236-
set_config_option("client_encoding", env, context,
237-
PGC_S_ENV_VAR, false, true);
238-
}
239186
240187
cleanup_list:
241188
if (apply_list)

src/backend/utils/misc/guc.c

Lines changed: 22 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.335 2006/08/11 20:15:16 momjian Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.336 2006/08/12 04:11:50 momjian Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -2694,39 +2694,39 @@ InitializeGUCOptions(void)
26942694
struct config_bool *conf = (struct config_bool *) gconf;
26952695

26962696
if (conf->assign_hook)
2697-
if (!(*conf->assign_hook) (conf->boot_val, true,
2697+
if (!(*conf->assign_hook) (conf->reset_val, true,
26982698
PGC_S_DEFAULT))
26992699
elog(FATAL, "failed to initialize %s to %d",
2700-
conf->gen.name, (int) conf->boot_val);
2701-
*conf->variable = conf->reset_val = conf->boot_val;
2700+
conf->gen.name, (int) conf->reset_val);
2701+
*conf->variable = conf->reset_val;
27022702
break;
27032703
}
27042704
case PGC_INT:
27052705
{
27062706
struct config_int *conf = (struct config_int *) gconf;
27072707

2708-
Assert(conf->boot_val >= conf->min);
2709-
Assert(conf->boot_val <= conf->max);
2708+
Assert(conf->reset_val >= conf->min);
2709+
Assert(conf->reset_val <= conf->max);
27102710
if (conf->assign_hook)
2711-
if (!(*conf->assign_hook) (conf->boot_val, true,
2711+
if (!(*conf->assign_hook) (conf->reset_val, true,
27122712
PGC_S_DEFAULT))
27132713
elog(FATAL, "failed to initialize %s to %d",
2714-
conf->gen.name, conf->boot_val);
2715-
*conf->variable = conf->reset_val = conf->boot_val;
2714+
conf->gen.name, conf->reset_val);
2715+
*conf->variable = conf->reset_val;
27162716
break;
27172717
}
27182718
case PGC_REAL:
27192719
{
27202720
struct config_real *conf = (struct config_real *) gconf;
27212721

2722-
Assert(conf->boot_val >= conf->min);
2723-
Assert(conf->boot_val <= conf->max);
2722+
Assert(conf->reset_val >= conf->min);
2723+
Assert(conf->reset_val <= conf->max);
27242724
if (conf->assign_hook)
2725-
if (!(*conf->assign_hook) (conf->boot_val, true,
2725+
if (!(*conf->assign_hook) (conf->reset_val, true,
27262726
PGC_S_DEFAULT))
27272727
elog(FATAL, "failed to initialize %s to %g",
2728-
conf->gen.name, conf->boot_val);
2729-
*conf->variable = conf->reset_val = conf->boot_val;
2728+
conf->gen.name, conf->reset_val);
2729+
*conf->variable = conf->reset_val;
27302730
break;
27312731
}
27322732
case PGC_STRING:
@@ -3179,7 +3179,7 @@ AtEOXact_GUC(bool isCommit, bool isSubXact)
31793179
for (i = 0; i < num_guc_variables; i++)
31803180
{
31813181
struct config_generic *gconf = guc_variables[i];
3182-
int my_status = gconf->status & (~GUC_IN_CONFFILE);
3182+
int my_status = gconf->status;
31833183
GucStack *stack = gconf->stack;
31843184
bool useTentative;
31853185
bool changed;
@@ -3726,19 +3726,8 @@ parse_value(int elevel, const struct config_generic *record,
37263726
}
37273727
else
37283728
{
3729-
/* Revert value to default if source is configuration file. It is used when
3730-
* configuration parameter is removed/commented out in the config file. Else
3731-
* RESET or SET TO DEFAULT command is called and reset_val is used.
3732-
*/
3733-
if( *source == PGC_S_FILE )
3734-
{
3735-
newval = conf->boot_val;
3736-
}
3737-
else
3738-
{
3739-
newval = conf->reset_val;
3740-
*source = conf->gen.reset_source;
3741-
}
3729+
newval = conf->reset_val;
3730+
*source = conf->gen.reset_source;
37423731
}
37433732

37443733
if (conf->assign_hook)
@@ -3781,19 +3770,8 @@ parse_value(int elevel, const struct config_generic *record,
37813770
}
37823771
else
37833772
{
3784-
/* Revert value to default if source is configuration file. It is used when
3785-
* configuration parameter is removed/commented out in the config file. Else
3786-
* RESET or SET TO DEFAULT command is called and reset_val is used.
3787-
*/
3788-
if( *source == PGC_S_FILE )
3789-
{
3790-
newval = conf->boot_val;
3791-
}
3792-
else
3793-
{
3794-
newval = conf->reset_val;
3795-
*source = conf->gen.reset_source;
3796-
}
3773+
newval = conf->reset_val;
3774+
*source = conf->gen.reset_source;
37973775
}
37983776

37993777
if (conf->assign_hook)
@@ -3836,19 +3814,8 @@ parse_value(int elevel, const struct config_generic *record,
38363814
}
38373815
else
38383816
{
3839-
/* Revert value to default if source is configuration file. It is used when
3840-
* configuration parameter is removed/commented out in the config file. Else
3841-
* RESET or SET TO DEFAULT command is called and reset_val is used.
3842-
*/
3843-
if( *source == PGC_S_FILE )
3844-
{
3845-
newval = conf->boot_val;
3846-
}
3847-
else
3848-
{
3849-
newval = conf->reset_val;
3850-
*source = conf->gen.reset_source;
3851-
}
3817+
newval = conf->reset_val;
3818+
*source = conf->gen.reset_source;
38523819
}
38533820

38543821
if (conf->assign_hook)
@@ -3882,20 +3849,6 @@ parse_value(int elevel, const struct config_generic *record,
38823849
if (conf->gen.flags & GUC_IS_NAME)
38833850
truncate_identifier(newval, strlen(newval), true);
38843851
}
3885-
else if (*source == PGC_S_FILE)
3886-
{
3887-
/* Revert value to default when item is removed from config file. */
3888-
if ( conf->boot_val != NULL )
3889-
{
3890-
newval = guc_strdup(elevel, conf->boot_val);
3891-
if (newval == NULL)
3892-
return false;
3893-
}
3894-
else
3895-
{
3896-
return false;
3897-
}
3898-
}
38993852
else if (conf->reset_val)
39003853
{
39013854
/*
@@ -4100,11 +4053,6 @@ verify_config_option(const char *name, const char *value,
41004053

41014054
if( parse_value(elevel, record, value, &source, false, &newval) )
41024055
{
4103-
/* Mark record like presented in the config file. Be carefull if
4104-
* you use this function for another purpose than config file
4105-
* verification. It causes confusion configfile parser. */
4106-
record->status |= GUC_IN_CONFFILE;
4107-
41084056
if( isNewEqual != NULL)
41094057
*isNewEqual = is_newvalue_equal(record, value);
41104058
if( isContextOK != NULL)
@@ -4167,7 +4115,7 @@ set_config_option(const char *name, const char *value,
41674115
* Should we set reset/stacked values? (If so, the behavior is not
41684116
* transactional.)
41694117
*/
4170-
makeDefault = changeVal && (source <= PGC_S_OVERRIDE) && (value != NULL || source == PGC_S_FILE);
4118+
makeDefault = changeVal && (source <= PGC_S_OVERRIDE) && (value != NULL);
41714119

41724120
/*
41734121
* Ignore attempted set if overridden by previously processed setting.

src/include/utils/guc_tables.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
99
*
10-
* $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.25 2006/08/11 20:15:16 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.26 2006/08/12 04:11:50 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -143,8 +143,7 @@ struct config_generic
143143
#define GUC_HAVE_TENTATIVE 0x0001 /* tentative value is defined */
144144
#define GUC_HAVE_LOCAL 0x0002 /* a SET LOCAL has been executed */
145145
#define GUC_HAVE_STACK 0x0004 /* we have stacked prior value(s) */
146-
#define GUC_IN_CONFFILE 0x0008 /* value shows up in the configuration
147-
file (is not commented) */
146+
148147

149148
/* GUC records for specific variable types */
150149

@@ -154,12 +153,11 @@ struct config_bool
154153
/* these fields must be set correctly in initial value: */
155154
/* (all but reset_val are constants) */
156155
bool *variable;
157-
bool boot_val;
156+
bool reset_val;
158157
GucBoolAssignHook assign_hook;
159158
GucShowHook show_hook;
160159
/* variable fields, initialized at runtime: */
161160
bool tentative_val;
162-
bool reset_val;
163161
};
164162

165163
struct config_int
@@ -168,14 +166,13 @@ struct config_int
168166
/* these fields must be set correctly in initial value: */
169167
/* (all but reset_val are constants) */
170168
int *variable;
171-
int boot_val;
169+
int reset_val;
172170
int min;
173171
int max;
174172
GucIntAssignHook assign_hook;
175173
GucShowHook show_hook;
176174
/* variable fields, initialized at runtime: */
177175
int tentative_val;
178-
int reset_val;
179176
};
180177

181178
struct config_real
@@ -184,14 +181,13 @@ struct config_real
184181
/* these fields must be set correctly in initial value: */
185182
/* (all but reset_val are constants) */
186183
double *variable;
187-
double boot_val;
184+
double reset_val;
188185
double min;
189186
double max;
190187
GucRealAssignHook assign_hook;
191188
GucShowHook show_hook;
192189
/* variable fields, initialized at runtime: */
193190
double tentative_val;
194-
double reset_val;
195191
};
196192

197193
struct config_string

0 commit comments

Comments
 (0)