Re: pgsql: pg_upgrade: Remove PGPORT handling from test suite

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: pg_upgrade: Remove PGPORT handling from test suite
Date: 2013-05-11 03:08:01
Message-ID: 1368241681.420.5.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Fri, 2013-05-10 at 18:17 -0400, Tom Lane wrote:
> It's probably not really necessary for the test script to try to
> duplicate the dynamic port-number testing done in pg_regress.c
> (especially since that isn't terribly bulletproof anyway). However,
> I think it should at least replicate this bit of logic:
>
> /*
> * To reduce chances of interference with parallel
> installations, use
> * a port number starting in the private range (49152-65535)
> * calculated from the version number.
> */
> port = 0xC000 | (PG_VERSION_NUM & 0x3FFF);
>
> since that should only take a couple of lines of shell scripting,
> and is enough to avoid collisions in ordinary cases.

That would be a good idea, but it seems independent of the code I
removed.

The only reason that the pg_upgrade test suite stayed out of the way of
the default port number is that it used a different hard-coded port
number, which also happened to be the production pg_upgrade port number.
That code was put in there before pg_upgrade itself switched to using
50432 by default.

The effect of having left that code in there was that multiple
concurrent pg_upgrade tests in different code trees with different
default ports would interfere with each other. That problem still
exists on platforms without Unix-domain sockets, however.

I think the complete solution here is something like

random_port=$(secret algorithm)
PGPORT=$random_port
PGOLDPORT=$random_port
PGNEWPORT=$random_port
export PGPORT PGOLDPORT PGNEWPORT

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-05-11 14:57:11 Re: pgsql: pg_upgrade: Remove PGPORT handling from test suite
Previous Message Tom Lane 2013-05-10 22:17:40 Re: pgsql: pg_upgrade: Remove PGPORT handling from test suite