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

Re: pg_ctl idempotent option

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_ctl idempotent option
Date: 2013-01-29 05:19:15
Message-ID: 51075BD3.3000201@agliodbs.com (view raw or flat)
Thread:
Lists: pgsql-hackers
> 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 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.
http://pgexperts.com


In response to

Responses

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2013-01-29 05:48:18
Subject: Re: psql \l to accept patterns
Previous:From: Josh BerkusDate: 2013-01-29 05:09:52
Subject: Re: autovacuum not prioritising for-wraparound tables

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