Re: 'pg_ctl -w' times out when unix_socket_directory is - Mailing list pgsql-general

From Jeff Davis
Subject Re: 'pg_ctl -w' times out when unix_socket_directory is
Date
Msg-id 1159395161.7578.210.camel@dogma.v10.wvs
Whole thread Raw
In response to 'pg_ctl -w' times out when unix_socket_directory is set  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: 'pg_ctl -w' times out when unix_socket_directory is  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Wed, 2006-09-27 at 14:26 -0700, Jeff Davis wrote:
> When I have "unix_socket_directory" set to an alternate value, "pg_ctl -
> D data -w start" times out. If I set it to default, it works fine.
>
> I'm using postgresql 8.1.4 on FreeBSD.
>
> Perhaps pg_ctl is waiting to see the socket file in /tmp/ before
> reporting that postgresql successfully started?
>

I took a look at the source quickly (as usual, the postgres source is so
easy to read I should have looked before I posted) and I found that the
problem seems to be in test_postmaster_connection() in pg_ctl.c.

The function checks for a non-default port, including scanning the
configuration file, but does not look for a non-default socket
directory.

It seems reasonable to add a check to find the real socket directory
before trying the connection.

I have attached a patch. I wrote it very quickly, but it seems to work
as I expect.

Regards,
    Jeff Davis

Attachment

pgsql-general by date:

Previous
From: "Karen Hill"
Date:
Subject: Re: cyclical redundancy checksum algorithm(s)?
Next
From: Lexington Luthor
Date:
Subject: Re: Solution for rolling back many transactions?