Re: [bug fix] pg_ctl always uses the same event source

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: MauMau <maumau307(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [bug fix] pg_ctl always uses the same event source
Date: 2013-12-12 04:51:20
Message-ID: CAA4eK1+RwOdPPH9Mir+5h-bd=PV2=zwn1tJk4fkcCUqf1HKWBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 11, 2013 at 8:31 PM, MauMau <maumau307(at)gmail(dot)com> wrote:
>>> From: "Amit Kapila" <amit(dot)kapila16(at)gmail(dot)com>
>
> I re-considered that. As you suggested, I think I'll do as follows. Would
> this be OK?
>
> [pg_ctl.c]
> evtHandle = RegisterEventSource(NULL, *event_source ? event_source :
> "PostgreSQL " PG_MAJORVERSION);
>
>
> [guc.c]
> {"event_source", PGC_POSTMASTER, LOGGING_WHERE,
> ...
> "PostgreSQL " PG_MAJORVERSION,
> NULL, NULL, NULL

This is similar to what I had in mind.

>
> [elog.c]
> Writing the default value in this file was redundant, because event_source
> cannot be NULL. So change
>
>
> evtHandle = RegisterEventSource(NULL, event_source ? event_source :
> "PostgreSQL");
>
> to
>
> evtHandle = RegisterEventSource(NULL, event_source);

I think this change might not be safe as write_eventlog() gets called
from write_stderr() which might get called
before reading postgresql.conf, so the code as exists in PG might be
to handle that case or some other similar
situation where event_source is still not set. Have you confirmed in
all ways that it is never the case that
event_source is not set when the control reaches this function.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2013-12-12 05:27:41 Re: Performance Improvement by reducing WAL for Update Operation
Previous Message Amit Kapila 2013-12-12 04:32:09 Re: Extra functionality to createuser