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: 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-05-03 06:24:50
Message-ID: CAA4eK1K1MWnpm2XxhMCQTWzebv8j37DMO4B_NL50rC=QvHv60w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 18, 2014 at 5:21 PM, MauMau <maumau307(at)gmail(dot)com> wrote:
> From: "Amit Kapila" <amit(dot)kapila16(at)gmail(dot)com>
>
>> Currently -e option is accepted with all the options that can be provided
>> in pg_ctl. Shouldn't we accept it only with options related to service,
>> because that is only when it will be used. Basically write_stderr() will
>> write to event log only incase of service.
>
>
> Thank you for your kind and patient review. I hope this will bear fruit.
>
> I don't find it so strange that -e is accepted by all operation modes of
> pg_ctl --- pg_ctl seems to handle switches that way. For example, -c is
> only relevant to start and restart, but it is accepted by all modes. -D is
> not relevant to pg_ctl kill, but it is not rejected. Plus, I prepared for
> the future possibility that other modes of pg_ctl will use event log.

Okay, as there is no check for not-required switches with other options,
we can ignore this as well.

I have verified the patch and it works fine on Windows, as per my
verification event-source in pg_ctl will be only used once the user has
registered the service and then when it tries to preform start/stop on
service. Although current usecase seems to be quite narrow for a new
switch, however in future we can extend it to use for other messages
in pg_ctl as well.

Only one minor suggestion:
+ Name of the event source for pg_ctl to use for event log. The
+ default is PostgreSQL.

From this description, it is not clear when the event log will be used
in pg_ctl. For example, if user uses -e option with register, then he
might expect any failure during register command will be logged into
eventlog, but that is not true. So I think we should improve the docs
to reflect the usage of -e.

On Linux, I am getting below build failure for pg_ctl

pg_ctl.c: In function ‘main’:
pg_ctl.c:2173: error: ‘event_source’ undeclared (first use in this function)
pg_ctl.c:2173: error: (Each undeclared identifier is reported only once
pg_ctl.c:2173: error: for each function it appears in.)
make[3]: *** [pg_ctl.o] Error 1
make[2]: *** [all-pg_ctl-recurse] Error 2
make[1]: *** [all-bin-recurse] Error 2
make: *** [all-src-recurse] Error 2

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2014-05-03 07:13:45 Re: tab completion for setting search_path
Previous Message Jeff Janes 2014-05-03 05:34:55 tab completion for setting search_path