Re: Unix-domain socket support on Windows
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-08-13T18:27:24Z
Lists: pgsql-hackers
Attachments
- v2-0001-Enable-Unix-domain-sockets-support-on-Windows.patch (text/plain) patch v2-0001
- v2-0002-Sort-out-getpeereid-and-struct-passwd-handling-on.patch (text/plain) patch v2-0002
- v2-0003-psql-Remove-one-use-of-HAVE_UNIX_SOCKETS.patch (text/plain) patch v2-0003
- v2-0004-libpq-Remove-unnecessary-uses-of-HAVE_UNIX_SOCKET.patch (text/plain) patch v2-0004
- v2-0005-initdb-Detect-Unix-domain-socket-support-dynamica.patch (text/plain) patch v2-0005
- v2-0006-Fix-handling-of-Unix-domain-sockets-on-Windows-in.patch (text/plain) patch v2-0006
- v2-0007-Disable-Unix-sockets-by-default-on-Windows.patch (text/plain) patch v2-0007
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
Commits
-
Allow using Unix-domain sockets on Windows in tests
- 1d53432ff940 13.0 landed
-
pg_regress: Observe TMPDIR
- 9cedb1666051 13.0 landed
-
Enable Unix-domain sockets support on Windows
- 8f3ec75de406 13.0 landed
-
psql: Remove one use of HAVE_UNIX_SOCKETS
- 541757f34ee0 13.0 landed
-
Allow building without default socket directory
- a9cff89f7e63 13.0 landed
-
Sort out getpeereid() and peer auth handling on Windows
- f14413b684d5 13.0 landed