Peter Eisentraut wrote:
> Alvaro Herrera wrote:
>> Is it possible to make it retry in case the chosen port is busy? I
>> guess a simple check should suffice, ignoring the obvious race condition
>> that someone uses the port after you checked it was OK.
> Well, the whole point of this exercise was to avoid that. If we had a
> way to do a "simple check", we might as well stick to the hardcoded port
> and count up from that or something.
Well, duh, the checking is actually pretty simple. We just try to
connect with psql to the candidate port number before starting our own
postmaster and see if anyone is already there.
Patch attached. It solves my immediate problems nicely.
In response to
pgsql-hackers by date
|Next:||From: Rob Kirkbride||Date: 2008-11-27 11:29:10|
|Subject: Re: Enhancement to pg_dump|
|Previous:||From: Peter Eisentraut||Date: 2008-11-27 09:37:48|
|Subject: Re: Thread safety|