Re: pg_ctl and port number detection

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: pg_ctl and port number detection
Дата
Msg-id 201012200247.oBK2lCx19956@momjian.us
обсуждение исходный текст
Ответ на Re: pg_ctl and port number detection  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: pg_ctl and port number detection  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Bruce Momjian wrote:
> Andrew Dunstan wrote:
> > 
> > 
> > On 12/18/2010 06:23 PM, Bruce Momjian wrote:
> > >
> > >> 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.
> > >
> > 
> > Wasn't there a proposal to provide an explicit port parameter to pg_ctl, 
> > instead of relying on PGPORT? That would probably be a small advance.
> 
> I do not remember that suggestion.
> 
> I wonder if we should write the port number as the 4th line in
> postmaster.pid and return in a few major releases and use that.  We
> could fall back and use our existing code if there is no 4th line.

OK, here is a modified idea.  For 9.1, we have the postmaster write the
port number as the fourth line in postmaster.pid.  pg_ctl will use that
fourth line if it exists, i.e. the postmaster is 9.1+.

If the fourth line is missing, we use the first number of the third line
on Unix and divide that by 1000 to get the port number.  That file
format is not going to change because it is pre-9.1.  If the third line
is empty (e.g. Windows) we either use PGPORT or throw an error.

So, we have a fine solution for 9.1+ servers, and all Unix servers, and
if you want to use a 9.1+ pg_ctl on a pre-9.1 server on Windows and use
the -w flag and a non-standard port number, you must specify PGPORT. 
Based on the fact that most Windows users use the one-click installer
that will use the matching pg_ctl version, it seems this will work just
fine.

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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: bug in SignalSomeChildren
Следующее
От: David Christensen
Дата:
Сообщение: Re: plperlu problem with utf8