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

Commitd56b3af

Browse files
committed
Restructure error handling in reading of postgresql.conf.
This patch has two distinct purposes: to report multiple problems inpostgresql.conf rather than always bailing out after the first one,and to change the policy for whether changes are applied when there areunrelated errors in postgresql.conf.Formerly the policy was to apply no changes if any errors could bedetected, but that had a significant consistency problem, because in somecases specific values might be seen as valid by some processes but invalidby others. This meant that the latter processes would fail to adoptchanges in other parameters even though the former processes had done so.The new policy is that during SIGHUP, the file is rejected as a wholeif there are any errors in the "name = value" syntax, or if any linesattempt to set nonexistent built-in parameters, or if any lines attemptto set custom parameters whose prefix is not listed in (the new value of)custom_variable_classes. These tests should always give the same resultsin all processes, and provide what seems a reasonably robust defenseagainst loading values from badly corrupted config files. If these testspass, all processes will apply all settings that they individually see asgood, ignoring (but logging) any they don't.In addition, the postmaster does not abandon reading a configuration fileafter the first syntax error, but continues to read the file and reportsyntax errors (up to a maximum of 100 syntax errors per file).The postmaster will still refuse to start up if the configuration filecontains any errors at startup time, but these changes allow multipleerrors to be detected and reported before quitting.Alexey Klyukin, reviewed by Andy Colson and av (Alexander ?)with some additional hacking by Tom Lane
1 parent5ec6b7f commitd56b3af

File tree

6 files changed

+281
-197
lines changed

6 files changed

+281
-197
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ include 'filename'
101101
value. Alternatively, you can send the signal to a single server
102102
process directly. Some parameters can only be set at server start;
103103
any changes to their entries in the configuration file will be ignored
104-
until the server is restarted.
104+
until the server is restarted. Invalid parameter settings in the
105+
configuration file are likewise ignored (but logged) during
106+
<systemitem>SIGHUP</> processing.
105107
</para>
106108

107109
<para>

‎src/backend/access/transam/xlog.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5295,10 +5295,12 @@ readRecoveryCommandFile(void)
52955295
}
52965296

52975297
/*
5298-
* Since we're asking ParseConfigFp() toerror out at FATAL, there's no
5299-
* need to check the return value.
5298+
* Since we're asking ParseConfigFp() toreport errors as FATAL, there's
5299+
*noneed to check the return value.
53005300
*/
5301-
ParseConfigFp(fd,RECOVERY_COMMAND_FILE,0,FATAL,&head,&tail);
5301+
(void)ParseConfigFp(fd,RECOVERY_COMMAND_FILE,0,FATAL,&head,&tail);
5302+
5303+
FreeFile(fd);
53025304

53035305
for (item=head;item;item=item->next)
53045306
{
@@ -5504,7 +5506,6 @@ readRecoveryCommandFile(void)
55045506
}
55055507

55065508
FreeConfigVariables(head);
5507-
FreeFile(fd);
55085509
}
55095510

55105511
/*

‎src/backend/commands/extension.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,10 @@ parse_extension_control_file(ExtensionControlFile *control,
472472
}
473473

474474
/*
475-
* Parse the file content, using GUC's file parsing code
475+
* Parse the file content, using GUC's file parsing code. We need not
476+
* check the return value since any errors will be thrown at ERROR level.
476477
*/
477-
ParseConfigFp(file,filename,0,ERROR,&head,&tail);
478+
(void)ParseConfigFp(file,filename,0,ERROR,&head,&tail);
478479

479480
FreeFile(file);
480481

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp