Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fb55af2

Browse files
committed
Back out patch to reorganize guc processing. Was causing regression
failures.
1 parent 2d2eec6 commit fb55af2

File tree

3 files changed

+249
-414
lines changed

3 files changed

+249
-414
lines changed

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

Lines changed: 19 additions & 55 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.41 2006/08/12 04:11:50 momjian Exp $
7+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.42 2006/08/12 04:12:41 momjian Exp $
88
*/
99

1010
%{
@@ -50,8 +50,7 @@ int GUC_yylex(void);
5050
static bool ParseConfigFile(const char *config_file, const char *calling_file,
5151
int depth, GucContext context, int elevel,
5252
struct name_value_pair **head_p,
53-
struct name_value_pair **tail_p,
54-
int *varcount);
53+
struct name_value_pair **tail_p);
5554
static void free_name_value_list(struct name_value_pair * list);
5655
static char *GUC_scanstr(const char *s);
5756

@@ -115,10 +114,8 @@ STRING \'([^'\\\n]|\\.|\'\')*\'
115114
void
116115
ProcessConfigFile(GucContext context)
117116
{
118-
int elevel, i;
117+
int elevel;
119118
struct name_value_pair *item, *head, *tail;
120-
bool *apply_list = NULL;
121-
int varcount = 0;
122119
123120
Assert(context == PGC_POSTMASTER || context == PGC_SIGHUP);
124121
@@ -137,56 +134,25 @@ ProcessConfigFile(GucContext context)
137134
138135
if (!ParseConfigFile(ConfigFileName, NULL,
139136
0, context, elevel,
140-
&head, &tail, &varcount))
137+
&head, &tail))
141138
goto cleanup_list;
142139
143-
/* Can we allocate memory here, what about leaving here prematurely? */
144-
apply_list = (bool *) palloc(sizeof(bool) * varcount);
145-
146140
/* Check if all options are valid */
147-
for (item = head, i = 0; item; item = item->next, i++)
141+
for (item = head; item; item = item->next)
148142
{
149-
bool isEqual, isContextOk;
150-
151-
if (!verify_config_option(item->name, item->value, context,
152-
PGC_S_FILE, &isEqual, &isContextOk))
153-
{
154-
ereport(elevel,
155-
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
156-
errmsg("configuration file is invalid")));
143+
if (!set_config_option(item->name, item->value, context,
144+
PGC_S_FILE, false, false))
157145
goto cleanup_list;
158-
}
159-
160-
if( isContextOk == false )
161-
{
162-
apply_list[i] = false;
163-
if( context == PGC_SIGHUP )
164-
{
165-
if ( isEqual == false )
166-
ereport(elevel,
167-
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
168-
errmsg("parameter \"%s\" cannot be changed after server start; configuration file change ignored",
169-
item->name)));
170-
}
171-
else
172-
/* if it is boot phase, context must be valid for all
173-
* configuration item. */
174-
goto cleanup_list;
175-
}
176-
else
177-
apply_list[i] = true;
178146
}
179147
180148
/* If we got here all the options checked out okay, so apply them. */
181-
for (item = head, i = 0; item; item = item->next, i++)
182-
if (apply_list[i])
183-
set_config_option(item->name, item->value, context,
184-
PGC_S_FILE, false, true);
185-
149+
for (item = head; item; item = item->next)
150+
{
151+
set_config_option(item->name, item->value, context,
152+
PGC_S_FILE, false, true);
153+
}
186154
187-
cleanup_list:
188-
if (apply_list)
189-
pfree(apply_list);
155+
cleanup_list:
190156
free_name_value_list(head);
191157
}
192158
@@ -223,14 +189,13 @@ static bool
223189
ParseConfigFile(const char *config_file, const char *calling_file,
224190
int depth, GucContext context, int elevel,
225191
struct name_value_pair **head_p,
226-
struct name_value_pair **tail_p,
227-
int *varcount)
192+
struct name_value_pair **tail_p)
228193
{
229-
bool OK = true;
230-
char abs_path[MAXPGPATH];
231-
FILE *fp;
194+
bool OK = true;
195+
char abs_path[MAXPGPATH];
196+
FILE *fp;
232197
YY_BUFFER_STATE lex_buffer;
233-
int token;
198+
int token;
234199

235200
/*
236201
* Reject too-deep include nesting depth. This is just a safety check
@@ -324,7 +289,7 @@ ParseConfigFile(const char *config_file, const char *calling_file,
324289

325290
if (!ParseConfigFile(opt_value, config_file,
326291
depth + 1, context, elevel,
327-
head_p, tail_p, varcount))
292+
head_p, tail_p))
328293
{
329294
pfree(opt_name);
330295
pfree(opt_value);
@@ -368,7 +333,6 @@ ParseConfigFile(const char *config_file, const char *calling_file,
368333
else
369334
(*tail_p)->next = item;
370335
*tail_p = item;
371-
(*varcount)++;
372336
}
373337

374338
/* break out of loop if read EOF, else loop for next line */

0 commit comments

Comments
 (0)