Re: pg_ctl and port number detection

Bruce Momjian <bruce@momjian.us>

From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrew Dunstan <andrew@dunslane.net>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2010-12-21T00:51:36Z
Lists: pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Tom Lane wrote:
> >> No.  If it goes in, it should go in as the third line.  The shmem key
> >> data is private to the server --- we do not want external programs
> >> assuming anything at all about the private part of postmaster.pid.
> 
> > OK, so you are suggesting having it as a third value on the third line?
> 
> > 	10231
> > 	/u/pgsql/data
> > 	  5432001  45481984 port_here
> > 	                    ^^^^^^^^^
> 
> I'm not sure why you're having such a hard time grasping this concept.
> We do not want pg_ctl looking at the shmem key information, not even to
> the extent of assuming a particular format for it.  Therefore the port
> number has to go before it not after it.  What I'm thinking of is
> 
> 	pid
> 	datadir
> 	port
> 	... here be dragons ...
> 
> Actually, if we're going to do this at all, we should do
> 
> 	pid
> 	datadir
> 	port
> 	socketdir
> 	... here be dragons ...
> 
> so that pg_ctl doesn't have to assume the server is running with a
> default value of unix_socket_dir.  Not sure what to put in the fourth
> line on Windows though ... maybe just leave it empty?

OK.  I was hesitant to modify the existing postmaster.pid format and was
trying to just add on the end.  It is certainly easier to put it before
the shared memory stuff.  I will work on a patch.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +