Re: pg_ctl and port number detection

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_ctl and port number detection
Date: 2010-12-18 23:23:53
Message-ID: 201012182323.oBINNrE15442@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > Tom Lane wrote:
> >> Bruce Momjian <bruce(at)momjian(dot)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(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2010-12-18 23:47:00 Re: pg_ctl and port number detection
Previous Message Tom Lane 2010-12-18 23:21:34 Re: pg_ctl and port number detection