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

Commit c62866e

Browse files
committed
Remove special-case treatment of LOG severity level in standalone mode.
elog.c has historically treated LOG messages as low-priority during bootstrap and standalone operation. This has led to confusion and even masked a bug, because the normal expectation of code authors is that elog(LOG) will put something into the postmaster log, and that wasn't happening during initdb. So get rid of the special-case rule and make the priority order the same as it is in normal operation. To keep from cluttering initdb's output and the behavior of a standalone backend, tweak the severity level of three messages routinely issued by xlog.c during startup and shutdown so that they won't appear in these cases. Per my proposal back in December.
1 parent f042163 commit c62866e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/backend/access/transam/xlog.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4883,9 +4883,12 @@ StartupXLOG(void)
48834883
(errmsg("control file contains invalid data")));
48844884

48854885
if (ControlFile->state == DB_SHUTDOWNED)
4886-
ereport(LOG,
4886+
{
4887+
/* This is the expected case, so don't be chatty in standalone mode */
4888+
ereport(IsPostmasterEnvironment ? LOG : NOTICE,
48874889
(errmsg("database system was shut down at %s",
48884890
str_time(ControlFile->time))));
4891+
}
48894892
else if (ControlFile->state == DB_SHUTDOWNED_IN_RECOVERY)
48904893
ereport(LOG,
48914894
(errmsg("database system was shut down in recovery at %s",
@@ -6590,7 +6593,8 @@ GetNextXidAndEpoch(TransactionId *xid, uint32 *epoch)
65906593
void
65916594
ShutdownXLOG(int code, Datum arg)
65926595
{
6593-
ereport(LOG,
6596+
/* Don't be chatty in standalone mode */
6597+
ereport(IsPostmasterEnvironment ? LOG : NOTICE,
65946598
(errmsg("shutting down")));
65956599

65966600
if (RecoveryInProgress())
@@ -6612,7 +6616,8 @@ ShutdownXLOG(int code, Datum arg)
66126616
ShutdownSUBTRANS();
66136617
ShutdownMultiXact();
66146618

6615-
ereport(LOG,
6619+
/* Don't be chatty in standalone mode */
6620+
ereport(IsPostmasterEnvironment ? LOG : NOTICE,
66166621
(errmsg("database system is shut down")));
66176622
}
66186623

src/backend/utils/error/elog.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,7 @@ errstart(int elevel, const char *filename, int lineno,
285285
*/
286286

287287
/* Determine whether message is enabled for server log output */
288-
if (IsPostmasterEnvironment)
289-
output_to_server = is_log_level_output(elevel, log_min_messages);
290-
else
291-
/* In bootstrap/standalone case, do not sort LOG out-of-order */
292-
output_to_server = (elevel >= log_min_messages);
288+
output_to_server = is_log_level_output(elevel, log_min_messages);
293289

294290
/* Determine whether message is enabled for client output */
295291
if (whereToSendOutput == DestRemote && elevel != COMMERROR)

0 commit comments

Comments
 (0)