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

Commit8bbf846

Browse files
committed
Silence extra logging when using "postgres -C" on runtime-computed GUCs
Presently, the server may emit a variety of log messages when inspectinga runtime-computed GUC, mostly in the shape of one LOG message with thedefault configuration, related to the startup sequence launched as suchGUCs require a load of the control file and of external sharedlibraries.For example, the server will always emit a "database system is shutdown" LOG (unless the user has set log_min_messages higher than LOG),which is an annoying behavior as "postgres -C" is expected to only emitin its output the parameter value we are looking for. The parametervalue is sent to stdout, while the logs are sent to stderr so we couldrecommend to use a redirection, but there was not much love for thisworkaround either.To avoid such extra log messages, per discussion, this change setslog_min_messages to FATAL internally when -C is used on aruntime-computed GUC (even if set to PANIC in postgresql.conf). AtFATAL, the user will still receive messages explaining why a GUC valuecannot be inspected, and will know if the command is attempted on aserver already running, something not supported yet for aruntime-computed GUC.Reported-by: Magnus Hagander, Bruce MomjianAuthor: Nathan Bossart, Michael PaquierDiscussion:https://postgr.es/m/Yni6ZHkGotUU+RSf@paquier.xyz
1 parent3aa7a3d commit8bbf846

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

‎doc/src/sgml/runtime.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ export PG_OOM_ADJUST_VALUE=0
14481448
server must be shut down to view this runtime-computed parameter.
14491449
This might look like:
14501450
<programlisting>
1451-
$ <userinput>postgres -D $PGDATA -C shared_memory_size_in_huge_pages 2> /dev/null</userinput>
1451+
$ <userinput>postgres -D $PGDATA -C shared_memory_size_in_huge_pages</userinput>
14521452
3170
14531453
$ <userinput>grep ^Hugepagesize /proc/meminfo</userinput>
14541454
Hugepagesize: 2048 kB

‎src/backend/postmaster/postmaster.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,16 @@ PostmasterMain(int argc, char *argv[])
913913
puts(config_val ?config_val :"");
914914
ExitPostmaster(0);
915915
}
916+
917+
/*
918+
* A runtime-computed GUC will be printed later on. As we initialize
919+
* a server startup sequence, silence any log messages that may show
920+
* up in the output generated. FATAL and more severe messages are
921+
* useful to show, even if one would only expect at least PANIC. LOG
922+
* entries are hidden.
923+
*/
924+
SetConfigOption("log_min_messages","FATAL",PGC_INTERNAL,
925+
PGC_S_OVERRIDE);
916926
}
917927

918928
/* Verify that DataDir looks reasonable */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp