Re: Unix-domain socket support on Windows

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unix-domain socket support on Windows
Date: 2019-08-13 18:27:24
Message-ID: 00d4945e-b437-f3b5-f4af-42e99321c846@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-08-07 15:56, Peter Eisentraut wrote:
> Depending on your Windows environment, there might not be a suitable
> /tmp directory, so you'll need to specify a directory explicitly using
> postgres -k or similar. This leads to the question what the default for
> DEFAULT_PGSOCKET_DIR should be on Windows. I think it's probably best,
> at least for now, to set it so that by default, neither server nor libpq
> use Unix sockets unless explicitly selected. This can be done easily on
> the server side by defining DEFAULT_PGSOCKET_DIR as "". But in libpq, I
> don't think the code would handle that correctly everywhere, so it would
> need some more analysis and restructuring possibly.

Updated patches, which now also address that issue: There is no default
socket dir on Windows and it's disabled by default on both client and
server.

Some comments on the patches:

v2-0001-Enable-Unix-domain-sockets-support-on-Windows.patch

This is pretty straightforward, apart from maybe some comments, but it
would need to be committed last, because it would enable all the Unix
socket related code on Windows, which needs to be fixed up by the
subsequent patches first.

v2-0002-Sort-out-getpeereid-and-struct-passwd-handling-on.patch

Maybe a more elegant way with fewer #ifdef WIN32 can be found?

v2-0003-psql-Remove-one-use-of-HAVE_UNIX_SOCKETS.patch

This could be committed independently.

v2-0004-libpq-Remove-unnecessary-uses-of-HAVE_UNIX_SOCKET.patch

This one as well.

v2-0005-initdb-Detect-Unix-domain-socket-support-dynamica.patch

I think this patch contains some nice improvements in general. How much
of that ends up being useful depends on how the subsequent patches (esp.
0007) end up, since with Unix-domain sockets disabled by default on
Windows, we won't need initdb doing any detection.

v2-0006-Fix-handling-of-Unix-domain-sockets-on-Windows-in.patch

This is a fairly independent and isolated change.

v2-0007-Disable-Unix-sockets-by-default-on-Windows.patch

This one is a bit complicated. Since there is no good default location
for Unix sockets on Windows, and many systems won't support them for
some time, the default implemented here is to not use them by default on
the server or client. This needs a fair amount of restructuring in the
to support the case of "supports Unix sockets but don't use them by
default", while maintaining the existing cases of "doesn't support Unix
sockets" and "use Unix sockets by default". There is some room for
discussion here.

This patch set needs testers with various Windows versions to test
different configurations, combinations, and versions.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v2-0001-Enable-Unix-domain-sockets-support-on-Windows.patch text/plain 4.5 KB
v2-0002-Sort-out-getpeereid-and-struct-passwd-handling-on.patch text/plain 5.4 KB
v2-0003-psql-Remove-one-use-of-HAVE_UNIX_SOCKETS.patch text/plain 1.2 KB
v2-0004-libpq-Remove-unnecessary-uses-of-HAVE_UNIX_SOCKET.patch text/plain 1.7 KB
v2-0005-initdb-Detect-Unix-domain-socket-support-dynamica.patch text/plain 8.4 KB
v2-0006-Fix-handling-of-Unix-domain-sockets-on-Windows-in.patch text/plain 5.6 KB
v2-0007-Disable-Unix-sockets-by-default-on-Windows.patch text/plain 4.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-08-13 18:49:34 Re: Fix runtime errors from -fsanitize=undefined
Previous Message Peter Geoghegan 2019-08-13 17:30:58 Re: Do not check unlogged indexes on standby