Re: pg_ctl status with nonexistent data directory - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: pg_ctl status with nonexistent data directory
Date
Msg-id CAA4eK1+Z3-VXi-mACMFkvZcqz9Ebihfw1o1Wv_UQuGome97RoQ@mail.gmail.com
Whole thread Raw
In response to Re: pg_ctl status with nonexistent data directory  (Bruce Momjian <bruce@momjian.us>)
Responses Re: pg_ctl status with nonexistent data directory  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
On Thu, Mar 6, 2014 at 7:46 PM, Bruce Momjian <bruce@momjian.us> wrote:
> On Thu, Mar  6, 2014 at 09:54:57AM +0530, Amit Kapila wrote:
>> > If they haven't passed us a data directory, we don't really know if the
>> > server is running or not, so the patch just returns '1'.
>>
>> But for such cases, isn't the status 4 more appropriate?
>> As per above link "4 program or service status is unknown"
>>
>> status 1 - "1 program is dead and /var/run pid file exists"
>> Going by this definition, it seems status 1 means, someone
>> has forcefully killed the server and pid file still remains.
>
> Technically, you are right, but I tried a while ago to assign meaningful
> values to all the exit locations and the community feedback I got was
> that we didn't want that.  I don't see how specifying non-existant or
> non-cluster directory would somehow be a case that would be special.

One reason could be that as we are already returning special exit code
for 'status' option of pg_ctl (exit(3)), this seems to be inline with it as this
also get called during status command.

Also in the link sent by you in another mail, I could see some statement
which indicates it is more important to return correct codes in case of
status which sounds a good reason to me.

Link and statement
http://www.postgresql.org/message-id/51D1E482.5090602@gmx.net

"The "status" case is different, because there the exit code
can be passed out by the init script directly."

If we just want to handle correct exit codes for "status" option, then
may be we need to refactor the code a bit to ensure the same.


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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: GSoC proposal - "make an unlogged table logged"
Next
From: Tom Lane
Date:
Subject: Re: pg_ctl status with nonexistent data directory