Re: pg_ctl and port number detection - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: pg_ctl and port number detection
Date
Msg-id 201012182323.oBINNrE15442@momjian.us
Whole thread Raw
In response to Re: pg_ctl and port number detection  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_ctl and port number detection  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Tom Lane wrote:
> >> Bruce Momjian <bruce@momjian.us> writes:
> >>> pg_ctl already knows the data directory.  If the file is missing, the
> >>> server is not running.  If the file exists, the first number on the last
> >>> line, divided by 1000, is the port number.
> 
> >> That's somewhere between fragile and outright wrong.
> 
> > Please explain why my idea is not an improvement.
> 
> Because it's assuming that those numbers are sysv shmem keys derived in
> a particular way.  We have platforms on which that is wrong, Windows
> being the most obvious example.  Reading the shmem key assignment code
> closely will suggest to you other ways that this could fail.  Not to
> mention that people propose getting rid of sysv shmem approximately
> every other month, and perhaps someday that will actually happen;
> whereupon whatever might get logged in postmaster.pid could be something
> completely different.

Yeah, I was afraid of Windows.

> If you really think that pulling a port number out of the pid file is an
> improvement over what pg_ctl does now, then you need to start by storing
> the port number, as such, in the pid file.  Not something that might or
> might not be related to the port number.  But what we have to discuss
> before that is whether we mind having a significant postmaster version
> dependency in pg_ctl.

OK, good point on the version issue.  Let's see if we get more
complaints before changing this.  Thanks.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_ctl and port number detection
Next
From: Andrew Dunstan
Date:
Subject: Re: pg_ctl and port number detection