Re: Patch review for logging hooks (CF 2012-01)

From: Martin Pihlak <martin(dot)pihlak(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Marti Raudsepp <marti(at)juffo(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch review for logging hooks (CF 2012-01)
Date: 2012-01-18 16:12:49
Message-ID: 4F16EF81.9070106@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01/18/2012 03:56 AM, Fujii Masao wrote:
> or syslog process (if you use syslog). So ISTM that there is no
> guarantee that the order of log messages processed by the
> hook is same as that of messages written to the log file. For
> example, imagine the case where two backends call EmitErrorReport()
> at the same time. Is this OK? If not, the hook might need to be
> in syslogger.

For high volume logging I'd avoid going through the syslogger. One
big issue with syslogger is that it creates a choke point - everything
has to pass through it, and if it cannot keep up it starts stalling
the backends. Also, in EmitErrorReport the hook gets to have access
to the actual ErrorData structure -- that makes filtering and looking
at message content much simpler.

> EmitErrorReport() can be called before shared library like Martin's
> pg_logforward is preloaded. Which means that the hook may miss
> some log messages. Is this OK?
>

True, even though the shared or local preload libraries are loaded
quite early in PostmasterMain/PostgresMain there is a chance that
some messages (mostly initialization failures) are missed. I guess
there is no way to avoid this with module based approach. But IMHO
this is acceptable -- when the backend fails to initialise, it cannot
be assumed that the logging subsystem is set up properly. I guess it
deserves at least a comment though. Thanks for pointing this out.

regards,
Martin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2012-01-18 16:27:40 Re: Patch review for logging hooks (CF 2012-01)
Previous Message Heikki Linnakangas 2012-01-18 16:01:56 Re: patch: fix SSI finished list corruption