Skip site navigation (1) Skip section navigation (2)

Re: pg_ctl idempotent option

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_ctl idempotent option
Date: 2013-01-29 06:32:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Tue, Jan 29, 2013 at 10:49 AM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:

> > OK, I had some time to think about this.  Basically, we have three
> > outcomes for pg_ctl start:
> >
> >       server not running and pg_ctl start success
> >       server start failed
> >       server already running
> >
> > Can't we just assign different return values to these cases, e.g. 0, 1,
> > 2?  We already print output telling the user what happened.
> Not sure if that would work.  Too many admin scripts only check for
> error output, and not what the error code was.
> FWIW, the Solaris/Opensolaris service scripts, as well as the RH service
> scripts (I think), already handle things this way.  If you say:
> svcadm enable postgresql
> ... and postgres is already up, it just returns 0.  So it's a common
> pattern.
> So, alternate suggestions to "idempotent":
> --isup
> --isrunning
> --ignorerunning
> However, I'm really beginnging to think that a switch isn't correct, and
> what we need to do is to have a different pg_ctl *command*, e.g.:
> pg_ctl -D . on
> or
> pg_ctl -D . enable
> I doubt if that would help much. We will need to coin a new command for
stop as well. A new pg_ctl command would confuse user as to what it should
be using "on" or "start" in a given scenario. I think switch is better.
Above switches won't look good with stop. We need some word/phrase which is
good for both start and stop commands.

> > I don't think I like --force because it isn't clear if we are forcing
> > the start to have done something, or forcing the server to be running.
> Agfeed.
> --
> Josh Berkus
> PostgreSQL Experts Inc.
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:

Best Wishes,
Ashutosh Bapat
EntepriseDB Corporation
The Enterprise Postgres Company

In response to

pgsql-hackers by date

Next:From: Dean RasheedDate: 2013-01-29 08:19:39
Subject: Re: Re: proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used
Previous:From: Alexander LawDate: 2013-01-29 06:00:12
Subject: Re: BUG #7493: Postmaster messages unreadable in a Windows console

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group