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

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: MauMau <maumau307(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [bug fix] pg_ctl always uses the same event source
Date: 2014-07-15 14:10:34
Message-ID: CABUevExWr_EY-qM-so9rzaPu0LjFZHGvBRZEsrwLt50B0p53Kg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 15, 2014 at 4:01 PM, MauMau <maumau307(at)gmail(dot)com> wrote:
> From: "Magnus Hagander" <magnus(at)hagander(dot)net>
>
>> Is there a reason for there still being changes in guc.c, pgevent.c
>> etc? Shouldn't it all be confined to pg_ctl now? That's my
>> understanding from the thread that that's the only part we care about.
>
>
> Yes, strictly speaking, those are useful for the original proposal. However,
> they are still useful as refactoring, since the current code has the default
> event source "PostgreSQL" in many places. Defining the default name only at
> one location would make it easier for vendors like EnterpriseDB to change
> the default name for their products. So I hope this will also be included
> if you don't want to reject it by all means.

Well, it does in a couple of places. I'm nto sure it's that important
(as nobody has AFAIK ever requested that change from for example EDB),
but it's not a bad thing. However, with a hardcoded service name, I
think the changes to pg_event.c are probably both not necessary and
actually bad - as you'll now start getting errors in more harmless
scenarios.

>> More importantly, isn't it wrong to claim it will only be used for
>> register and unregister? If we get an early failure in start, for
>> example, there are numerous codepaths that will end up calling
>> write_stderr(), which will use the eventlog when running as a service.
>> Shouldn't the "-e" parameter be moved under "common options"?
>
>
> Yes, you are right. -e is effective only if pg_ctl is invoked as a Windows
> service. So it is written at register mode. That is, -e specifies the
> event source used by the Windows service which is registered by "pg_ctl
> register".

Oh, right. I see what you mean now. That goes for all parameters
though, including -D, and we don't specify those as register mode
only, so I still think it's wrong to place it there. It is now grouped
with all other parameters that we specifically *don't* write to the
commandline of the service.

>> I also think we should have the documentation specifically note that
>> regular postgres output still goes to whatever the backend is
>> configured to do. (and of course, any failure within the backend
>> *before* we have parsed the config file for example will still go to
>> the default source, and not the pg_ctl source - so we need to make it
>> really clear that this is *only* for output from pg_ctl).
>
>
> I see. I added this clarification to the description of -e. I would
> appreciate it if you could correct my poor English when committing, if it
> needs improvement.

Sure, no problem.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-07-15 14:17:22 Re: Getting list of held lwlocks from debugger
Previous Message MauMau 2014-07-15 14:01:51 Re: [bug fix] pg_ctl always uses the same event source