Re: Adjusting elog behavior in bootstrap/standalone mode

From: Noah Misch <noah(at)leadboat(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Adjusting elog behavior in bootstrap/standalone mode
Date: 2012-12-17 01:17:58
Message-ID: 20121217011758.GA5291@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 14, 2012 at 04:20:30PM -0500, Tom Lane wrote:
> /* Determine whether message is enabled for server log output */
> if (IsPostmasterEnvironment)
> output_to_server = is_log_level_output(elevel, log_min_messages);
> else
> /* In bootstrap/standalone case, do not sort LOG out-of-order */
> output_to_server = (elevel >= log_min_messages);
>
> In view of the confusion this caused just now, I wondered if we shouldn't
> get rid of the special case and always follow the is_log_level_output
> rule. I tried modifying the code that way, and soon found that it made
> initdb rather noisy:

I can see why it was done that way, but agreed.

> creating configuration files ... ok
> creating template1 database in /home/postgres/data/base/1 ... LOG: bogus data in "postmaster.pid"
> LOG: database system was shut down at 2012-12-14 15:55:35 EST
> LOG: shutting down
> LOG: database system is shut down

> One possibility is to tweak the elog call sites for these specific
> messages so that they are, say, NOTICE not LOG level when not
> IsPostmasterEnvironment. That seems like a bit of a hack, but
> I don't see another answer that doesn't involve behind-the-scenes
> decisions in elog.c ... which is exactly what I want to get rid of.

Your proposed hack seems decent. The second and third lines, in particular,
are rather useless here despite their utility under normal logging.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2012-12-17 02:44:00 Re: Support for REINDEX CONCURRENTLY
Previous Message Tomas Vondra 2012-12-17 00:07:42 Re: too much pgbench init output