Re: pgsql: Fix unlink() for STATUS_DELETE_PENDING on Windows.

2022-10-25 Thread Thomas Munro
On Wed, Oct 26, 2022 at 12:57 PM Justin Pryzby wrote: > On Wed, Oct 26, 2022 at 11:15:16AM +1300, Thomas Munro wrote: > > On Wed, Oct 26, 2022 at 10:31 AM Justin Pryzby wrote: > > > > If I'm not wrong, this didn't fix the issue you said it fixed. > > > > &g

Re: pgsql: Fix unlink() for STATUS_DELETE_PENDING on Windows.

2022-10-25 Thread Thomas Munro
On Wed, Oct 26, 2022 at 10:31 AM Justin Pryzby wrote: > On Tue, Oct 25, 2022 at 04:21:02PM -0500, Justin Pryzby wrote: > > > Restore that behavior with an explicit check, to see if it fixes the > > > occasional 'directory not empty' failures seen in the pg_upgrade tests > > > on CI. Further

pgsql: Fix lstat() for broken junction points on Windows.

2022-10-24 Thread Thomas Munro
Fix lstat() for broken junction points on Windows. When using junction points to emulate symlinks on Windows, one edge case was not handled correctly by commit c5cb8f3b: if a junction point is broken (pointing to a non-existent path), we'd report ENOENT. This doesn't break any known use case,

pgsql: Fix stat() for recursive junction points on Windows.

2022-10-24 Thread Thomas Munro
Fix stat() for recursive junction points on Windows. Commit c5cb8f3b supposed that we'd only ever have to follow one junction point in stat(), because we don't construct longer chains of them ourselves. When examining a parent directory supplied by the user, we should really be able to cope with

pgsql: Fix readlink() for non-PostgreSQL junction points on Windows.

2022-10-24 Thread Thomas Munro
Fix readlink() for non-PostgreSQL junction points on Windows. Since commit c5cb8f3b taught stat() to follow symlinks, and since initdb uses pg_mkdir_p(), and that examines parent directories, our humble readlink() implementation can now be exposed to junction points not of PostgreSQL origin.

pgsql: Fix readlink() return value on Windows.

2022-10-24 Thread Thomas Munro
Fix readlink() return value on Windows. Ancient bug noticed while working on a test suite for these functions. Discussion: https://postgr.es/m/CA%2BhUKG%2BajSQ_8eu2AogTncOnZ5me2D-Cn66iN_-wZnRjLN%2Bicg%40mail.gmail.com Branch -- master Details ---

pgsql: Fix symlink() errno on Windows.

2022-10-24 Thread Thomas Munro
Fix symlink() errno on Windows. Ancient bug noticed while working on a test suite for these functions. https://postgr.es/m/CA%2BhUKG%2BajSQ_8eu2AogTncOnZ5me2D-Cn66iN_-wZnRjLN%2Bicg%40mail.gmail.com Branch -- master Details ---

pgsql: Fix unlink() for STATUS_DELETE_PENDING on Windows.

2022-10-24 Thread Thomas Munro
Fix unlink() for STATUS_DELETE_PENDING on Windows. Commit f357233c assumed that it was OK to return ENOENT directly if lstat() failed that way. If we got STATUS_DELETE_PENDING while trying to unlink a file that we had already unlinked successfully once before but someone else still had open (on

pgsql: Track LLVM 15 changes.

2022-10-19 Thread Thomas Munro
Track LLVM 15 changes. Per https://llvm.org/docs/OpaquePointers.html, support for non-opaque pointers still exists and we can request that on our context. We have until LLVM 16 to move to opaque pointers, a much larger change. Back-patch to 11, where LLVM support arrived. Author: Thomas Munro

pgsql: Track LLVM 15 changes.

2022-10-19 Thread Thomas Munro
Track LLVM 15 changes. Per https://llvm.org/docs/OpaquePointers.html, support for non-opaque pointers still exists and we can request that on our context. We have until LLVM 16 to move to opaque pointers, a much larger change. Back-patch to 11, where LLVM support arrived. Author: Thomas Munro

pgsql: Track LLVM 15 changes.

2022-10-19 Thread Thomas Munro
Track LLVM 15 changes. Per https://llvm.org/docs/OpaquePointers.html, support for non-opaque pointers still exists and we can request that on our context. We have until LLVM 16 to move to opaque pointers, a much larger change. Back-patch to 11, where LLVM support arrived. Author: Thomas Munro

pgsql: Track LLVM 15 changes.

2022-10-19 Thread Thomas Munro
Track LLVM 15 changes. Per https://llvm.org/docs/OpaquePointers.html, support for non-opaque pointers still exists and we can request that on our context. We have until LLVM 16 to move to opaque pointers, a much larger change. Back-patch to 11, where LLVM support arrived. Author: Thomas Munro

pgsql: Track LLVM 15 changes.

2022-10-19 Thread Thomas Munro
Track LLVM 15 changes. Per https://llvm.org/docs/OpaquePointers.html, support for non-opaque pointers still exists and we can request that on our context. We have until LLVM 16 to move to opaque pointers, a much larger change. Back-patch to 11, where LLVM support arrived. Author: Thomas Munro

pgsql: Track LLVM 15 changes.

2022-10-19 Thread Thomas Munro
Track LLVM 15 changes. Per https://llvm.org/docs/OpaquePointers.html, support for non-opaque pointers still exists and we can request that on our context. We have until LLVM 16 to move to opaque pointers, a much larger change. Back-patch to 11, where LLVM support arrived. Author: Thomas Munro

pgsql: Restore pg_pread and friends.

2022-09-28 Thread Thomas Munro
Restore pg_pread and friends. Commits cf112c12 and a0dc8271 were a little too hasty in getting rid of the pg_ prefixes where we use pread(), pwrite() and vectored variants. We dropped support for ancient Unixes where we needed to use lseek() to implement replacements for those, but it turns out

pgsql: ci: Increase requested memory size.

2022-09-21 Thread Thomas Munro
ci: Increase requested memory size. CI builds recently started failing with: "Memory size for 4.0 vCPU instance should be between 3840MiB and 26624MiB, while 2048MiB is requested." Ok then, let's ask for 4G instead of 2G. This may be due to a change in the type of instance used to work around

pgsql: ci: Increase requested memory size.

2022-09-21 Thread Thomas Munro
ci: Increase requested memory size. CI builds recently started failing with: "Memory size for 4.0 vCPU instance should be between 3840MiB and 26624MiB, while 2048MiB is requested." Ok then, let's ask for 4G instead of 2G. This may be due to a change in the type of instance used to work around

pgsql: Fix recovery_prefetch with low maintenance_io_concurrency.

2022-09-08 Thread Thomas Munro
Fix recovery_prefetch with low maintenance_io_concurrency. We should process completed IOs *before* trying to start more, so that it is always possible to decode one more record when the decoded record queue is empty, even if maintenance_io_concurrency is set so low that a single earlier WAL

pgsql: Fix recovery_prefetch with low maintenance_io_concurrency.

2022-09-08 Thread Thomas Munro
Fix recovery_prefetch with low maintenance_io_concurrency. We should process completed IOs *before* trying to start more, so that it is always possible to decode one more record when the decoded record queue is empty, even if maintenance_io_concurrency is set so low that a single earlier WAL

pgsql: Fix cache invalidation bug in recovery_prefetch.

2022-09-02 Thread Thomas Munro
Fix cache invalidation bug in recovery_prefetch. XLogPageRead() can retry internally after a pread() system call has succeeded, in the case of short reads, and page validation failures while in standby mode (see commit 0668719801). Due to an oversight in commit 3f1ce973, these cases could leave

pgsql: Fix cache invalidation bug in recovery_prefetch.

2022-09-02 Thread Thomas Munro
Fix cache invalidation bug in recovery_prefetch. XLogPageRead() can retry internally after a pread() system call has succeeded, in the case of short reads, and page validation failures while in standby mode (see commit 0668719801). Due to an oversight in commit 3f1ce973, these cases could leave

pgsql: Remove configure probe for sockaddr_in6 and require AF_INET6.

2022-08-25 Thread Thomas Munro
Remove configure probe for sockaddr_in6 and require AF_INET6. SUSv3 defines struct sockaddr_in6, and all targeted Unix systems have it. Windows has it in . Remove the configure probe, the macro and a small amount of dead code. Also remove a mention of IPv6-less builds from the documentation,

pgsql: Don't bother to set sockaddr_un.sun_len.

2022-08-23 Thread Thomas Munro
Don't bother to set sockaddr_un.sun_len. It's not necessary to fill in sun_len when calling bind() or connect(), on all known systems that have it. Discussion: https://postgr.es/m/2781112.1644819528%40sss.pgh.pa.us Branch -- master Details ---

pgsql: Remove configure probes for sockaddr_storage members.

2022-08-21 Thread Thomas Munro
Remove configure probes for sockaddr_storage members. Remove four probes for members of sockaddr_storage. Keep only the probe for sockaddr's sa_len, which is enough for our two remaining places that know about _len fields: 1. ifaddr.c needs to know if sockaddr has sa_len to understand the

pgsql: Fix macro problem with gai_strerror on Windows.

2022-08-17 Thread Thomas Munro
Fix macro problem with gai_strerror on Windows. Commit 5579388d was confused about why gai_strerror() didn't work, and used gai_strerrorA(). It turns out that we had explicitly undefined Windows' own macro for that somewhere else. Get rid of all that, and use the system headers' definition of

pgsql: Remove dead ifaddr.c fallback code.

2022-08-17 Thread Thomas Munro
Remove dead ifaddr.c fallback code. We carried a special implementation of pg_foreach_ifaddr() using Solaris's ioctl(SIOCGLIFCONF), but Solaris 11 and illumos adopted getifaddrs() more than a decade ago, and we prefer to use that. Solaris 10 is EOL'd. Remove the dead code. Adjust comment about

pgsql: mstcpip.h is not missing on MinGW.

2022-08-17 Thread Thomas Munro
mstcpip.h is not missing on MinGW. Remove a small difference between MinGW and MSVC builds which isn't needed for modern MinGW, noticed in passing. Discussion: https://postgr.es/m/ca+hukgkernfhmvb_h0upremp4lpzgn06yr2_0tyikjzb-2e...@mail.gmail.com Branch -- master Details ---

pgsql: Remove configure probe for netinet/tcp.h.

2022-08-17 Thread Thomas Munro
Remove configure probe for netinet/tcp.h. is in SUSv3 and all targeted Unix systems have it. For Windows, we can provide a stub include file, to avoid some #ifdef noise. Discussion: https://postgr.es/m/ca+hukgkernfhmvb_h0upremp4lpzgn06yr2_0tyikjzb-2e...@mail.gmail.com Branch -- master

pgsql: Remove configure probe for sys/sockio.h.

2022-08-17 Thread Thomas Munro
Remove configure probe for sys/sockio.h. On BSD-family systems, header defines socket ioctl numbers like SIOCGIFCONF. Only AIX is using those now, but it defines them in anyway. Supposing some PostgreSQL hacker wants to test that AIX-only code path on a more common development system by

pgsql: Remove configure probe for net/if.h.

2022-08-17 Thread Thomas Munro
Remove configure probe for net/if.h. is in SUSv3 and all targeted Unixes have it. It's used in a region that is already ifdef'd out for Windows. We're not using it for any standard definitions, but it's where AIX defines conventional socket ioctl numbers. Discussion:

pgsql: Fix headerscheck and cpluspluscheck's exit codes.

2022-08-15 Thread Thomas Munro
Fix headerscheck and cpluspluscheck's exit codes. For the benefit of CI, which started running these header check scripts in its CompilerWarnings task in commit 81b9f23c9c8, they should report failure if any individual header failed to compile. Reviewed-by: Andrew Dunstan Reviewed-by: Andres

pgsql: Add new win32 header to headerscheck and cpluspluscheck

2022-08-13 Thread Thomas Munro
Add new win32 header to headerscheck and cpluspluscheck Commit 5579388d added src/include/port/win32/netdb.h but forgot to filter it out in the header checking scripts. Per build farm animal crake. Branch -- master Details ---

pgsql: Remove configure probe for gethostbyname_r.

2022-08-13 Thread Thomas Munro
Remove configure probe for gethostbyname_r. It was only used by src/port/getaddrinfo.c, removed by the previous commit. Discussion: https://postgr.es/m/CA%2BhUKGJFLPCtAC58EAimF6a6GPw30TU_59FUY%3DGWB_kC%3DJEmVQ%40mail.gmail.com Branch -- master Details ---

pgsql: Remove replacement code for getaddrinfo.

2022-08-13 Thread Thomas Munro
Remove replacement code for getaddrinfo. SUSv3, all targeted Unixes and modern Windows have getaddrinfo() and related interfaces. Drop the replacement implementation, and adjust some headers slightly to make sure that the APIs are visible everywhere using standard POSIX headers and names.

pgsql: Remove configure probe for struct sockaddr_storage.

2022-08-13 Thread Thomas Munro
Remove configure probe for struct sockaddr_storage. provides sockaddr_storage in SUSv3 and all targeted Unix systems have it. Windows has it too. Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com Branch --

pgsql: Remove HAVE_UNIX_SOCKETS.

2022-08-13 Thread Thomas Munro
Remove HAVE_UNIX_SOCKETS. Since HAVE_UNIX_SOCKETS is now defined unconditionally, remove the macro and drop a small amount of dead code. The last known systems not to have them (as far as I know at least) were QNX, which we de-supported years ago, and Windows, which now has them. If a new OS

pgsql: Remove configure probe for sys/select.h.

2022-08-13 Thread Thomas Munro
Remove configure probe for sys/select.h. is in SUSv3 and every targeted Unix system has it. Provide an empty header in src/include/port/win32 so that we can include it unguarded even on Windows. Reviewed-by: Tom Lane Discussion:

pgsql: Remove configure probe for sys/uio.h.

2022-08-13 Thread Thomas Munro
Remove configure probe for sys/uio.h. is in SUSv2, and all targeted Unix system have it, so we might as well drop the probe (in fact we never really needed this one). It's where struct iovec is defined, and as a common extension, it's also where non-standard preadv() and pwritev() are declared

pgsql: Remove configure probe for shl_load library.

2022-08-13 Thread Thomas Munro
Remove configure probe for shl_load library. This was needed only by HP-UX 10, so it became redundant with commit 9db300ce. Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com Branch -- master Details ---

pgsql: Remove configure probes for sys/un.h and struct sockaddr_un.

2022-08-13 Thread Thomas Munro
Remove configure probes for sys/un.h and struct sockaddr_un. is in SUSv3 and every targeted Unix has it. Some Windows tool chains may still lack the approximately equivalent header , so we already defined struct sockaddr_un ourselves on that OS for now. To harmonize things a bit, move our

pgsql: Remove configure probe for sys/resource.h and refactor.

2022-08-13 Thread Thomas Munro
Remove configure probe for sys/resource.h and refactor. is in SUSv2 and is on all targeted Unix systems. We have a replacement for getrusage() on Windows, so let's just move its declarations into src/include/port/win32/sys/resource.h so that we can use a standard-looking #include. Also remove

pgsql: Remove configure probes for sys/ipc.h, sys/sem.h, sys/shm.h.

2022-08-13 Thread Thomas Munro
Remove configure probes for sys/ipc.h, sys/sem.h, sys/shm.h. These are in SUSv2 and every targeted Unix system has them. It's not hard to avoid including them on Windows system because they're mostly used in platform-specific translation units. Reviewed-by: Tom Lane Discussion:

pgsql: Fix obsolete comment in commit_ts.c.

2022-08-08 Thread Thomas Munro
Fix obsolete comment in commit_ts.c. Commit 08aa89b removed COMMIT_TS_SETTS, but left a reference in a comment. Author: Nathan Bossart Discussion: https://postgr.es/m/20220726173343.GA154110%40nathanxps13 Branch -- master Details ---

pgsql: Fix obsolete comments in instr_time.h.

2022-08-08 Thread Thomas Munro
Fix obsolete comments in instr_time.h. Commit 623cc673 removed gettimeofday(), and commits 24c3ce8f and 495ed0ef removed support for very old Windows releases with low accuracy timers, but references to those things were left behind in comments. Reported-by: Tom Lane Discussion:

pgsql: Simplify replacement code for strtof.

2022-08-06 Thread Thomas Munro
Simplify replacement code for strtof. strtof() is in C99 and all targeted systems have it. We can remove the configure probe and some dead code, but we still need replacement code for a couple of systems that have known buggy implementations selected via platform template. Reviewed-by: Tom Lane

pgsql: Simplify gettimeofday for Windows.

2022-08-06 Thread Thomas Munro
Simplify gettimeofday for Windows. Previously we bothered to forward-declare struct timezone, following man pages on typical systems, but POSIX actually says the argument (which we ignore anyway) is void *. Drop a line. While here, add an assertion that nobody actually uses the tzp argument.

pgsql: Make unlink() work for junction points on Windows.

2022-08-05 Thread Thomas Munro
Make unlink() work for junction points on Windows. To support harmonization of Windows and Unix code, teach our unlink() wrapper that junction points need to be unlinked with rmdir() on Windows. Tested-by: Andrew Dunstan Discussion:

pgsql: Provide lstat() for Windows.

2022-08-05 Thread Thomas Munro
Provide lstat() for Windows. Junction points will be reported with S_ISLNK(x.st_mode), simulating POSIX lstat(). stat() will follow pseudo-symlinks, like in POSIX (but only one level before giving up, unlike in POSIX). This completes a TODO left by commit bed90759fcb. Tested-by: Andrew Dunstan

pgsql: Replace pgwin32_is_junction() with lstat().

2022-08-05 Thread Thomas Munro
Replace pgwin32_is_junction() with lstat(). Now that lstat() reports junction points with S_IFLNK/S_ISLINK(), and unlink() can unlink them, there is no need for conditional code for Windows in a few places. That was expressed by testing for WIN32 or S_ISLNK, which we can now constant-fold. The

pgsql: Remove fallbacks for strtoll, strtoull.

2022-08-05 Thread Thomas Munro
a declaration. The last known instance on the buildfarm was running an ancient OSX and shut down in 2019. Author: Andres Freund Reviewed-by: Thomas Munro Discussion: https://postgr.es/m/20220804013546.h65najrzig764...@awork3.anarazel.de Branch -- master Details --- https://git.postgresql.org

pgsql: Remove configure probe for fdatasync.

2022-08-04 Thread Thomas Munro
Remove configure probe for fdatasync. fdatasync() is in SUSv2, and all targeted Unix systems have it. We have a replacement function for Windows. We retain the probe for the function declaration, which allows us to supply the mysteriously missing declaration for macOS, and also for Windows. No

pgsql: Remove configure probe for clock_gettime.

2022-08-04 Thread Thomas Munro
Remove configure probe for clock_gettime. clock_gettime() is in SUSv2 and all targeted Unix systems have it. Remove a chunk of fallback code for old Unix is no longer reachable on modern systems, and untested as of the retirement of build farm animal prairiedog. There is no need to retain a

pgsql: Simplify replacement code for preadv and pwritev.

2022-08-04 Thread Thomas Munro
Simplify replacement code for preadv and pwritev. preadv() and pwritev() are not standardized by POSIX, but appeared in NetBSD in 1999 and were adopted by at least OpenBSD, FreeBSD, DragonFlyBSD, Linux, AIX, illumos and macOS. We don't use them much yet, but an active proposal uses them heavily.

pgsql: Remove configure probe for shm_open.

2022-08-04 Thread Thomas Munro
Remove configure probe for shm_open. shm_open() is in SUSv2 and all targeted Unix systems have it. We retain a HAVE_SHM_OPEN macro, because it's clearer to readers than something like !defined(WIN32). Reviewed-by: Tom Lane Reviewed-by: Andres Freund Discussion:

pgsql: Remove configure probes for symlink/readlink, and dead code.

2022-08-04 Thread Thomas Munro
Remove configure probes for symlink/readlink, and dead code. symlink() and readlink() are in SUSv2 and all targeted Unix systems have them. We have partial emulation on Windows. Code that raised runtime errors on systems without it has been dead for years, so we can remove that and also

pgsql: Remove configure probe for setsid.

2022-08-04 Thread Thomas Munro
Remove configure probe for setsid. setsid() is in SUSv2 and all targeted Unix systems have it. Retain a HAVE_SETSID macro, defined on Unix only. That's easier to understand than !defined(WIN32), for the optional code it governs. Reviewed-by: Tom Lane Reviewed-by: Andres Freund Discussion:

pgsql: Remove dead pread and pwrite replacement code.

2022-08-04 Thread Thomas Munro
Remove dead pread and pwrite replacement code. pread() and pwrite() are in SUSv2, and all targeted Unix systems have them. Previously, we defined pg_pread and pg_pwrite to emulate these function with lseek() on old Unixen. The names with a pg_ prefix were a reminder of a portability hazard:

pgsql: Remove configure probes for poll and poll.h.

2022-08-04 Thread Thomas Munro
Remove configure probes for poll and poll.h. poll() and are in SUSv2 and all targeted Unix systems have them. Retain HAVE_POLL and HAVE_POLL_H macros for readability. There's an error in latch.c that is now unreachable (since we always have one of WIN32 or HAVE_POLL defined), but that falls

pgsql: Remove configure probe and related tests for getrlimit.

2022-08-04 Thread Thomas Munro
Remove configure probe and related tests for getrlimit. getrlimit() is in SUSv2 and all targeted systems have it. Windows doesn't have it. We could just use #ifndef WIN32, but for a little more explanation about why we're making things conditional, let's retain the HAVE_GETRLIMIT macro. It's

pgsql: Remove configure probe for link.

2022-08-04 Thread Thomas Munro
Remove configure probe for link. link() is in SUSv2 and all targeted Unix systems have it. We have replacement code for Windows that doesn't require a configure probe. Since only Windows needs it, rename src/port/link.c to win32link.c like other similar things. There is no need for a vestigial

pgsql: Remove dead setenv, unsetenv replacement code.

2022-08-04 Thread Thomas Munro
Remove dead setenv, unsetenv replacement code. setenv() and unsetenv() are in SUSv3 and targeted Unix systems have them. We still need special code for these on Windows, but that doesn't require a configure probe. This marks the first time we require a SUSv3 (POSIX.1-2001) facility (rather than

pgsql: Remove configure probe for dlopen, and refactor.

2022-08-04 Thread Thomas Munro
Remove configure probe for dlopen, and refactor. dlopen() is in SUSv2 and all targeted Unix systems have it. We still need replacement functions for Windows, but we don't need a configure probe for that. Since it's no longer needed by other operating systems, rename dlopen.c to win32dlopen.c

pgsql: Fix get_dirent_type() for symlinks on MinGW/MSYS.

2022-07-27 Thread Thomas Munro
Fix get_dirent_type() for symlinks on MinGW/MSYS. On Windows with MSVC, get_dirent_type() was recently made to return DT_LNK for junction points by commit 9d3444dc, which fixed some defective dirent.c code. On Windows with Cygwin, get_dirent_type() already worked for symlinks, as it does on

pgsql: Fix get_dirent_type() for symlinks on MinGW/MSYS.

2022-07-27 Thread Thomas Munro
Fix get_dirent_type() for symlinks on MinGW/MSYS. On Windows with MSVC, get_dirent_type() was recently made to return DT_LNK for junction points by commit 9d3444dc, which fixed some defective dirent.c code. On Windows with Cygwin, get_dirent_type() already worked for symlinks, as it does on

pgsql: Fix get_dirent_type() for symlinks on MinGW/MSYS.

2022-07-27 Thread Thomas Munro
Fix get_dirent_type() for symlinks on MinGW/MSYS. On Windows with MSVC, get_dirent_type() was recently made to return DT_LNK for junction points by commit 9d3444dc, which fixed some defective dirent.c code. On Windows with Cygwin, get_dirent_type() already worked for symlinks, as it does on

Re: pgsql: Remove the restriction that the relmap must be 512 bytes.

2022-07-27 Thread Thomas Munro
On Wed, Jul 27, 2022 at 6:06 PM Thomas Munro wrote: > On Wed, Jul 27, 2022 at 5:01 PM Thomas Munro wrote: > > Someone else still has the old file open, so we can't rename the new > > one to its name? On Windows that should have gone through pgrename() > > in dirmod.c,

Re: pgsql: Remove the restriction that the relmap must be 512 bytes.

2022-07-27 Thread Thomas Munro
On Wed, Jul 27, 2022 at 5:01 PM Thomas Munro wrote: > On Wed, Jul 27, 2022 at 4:35 PM Michael Paquier wrote: > > On Tue, Jul 26, 2022 at 07:10:22PM +, Robert Haas wrote: > > > Remove the restriction that the relmap must be 512 bytes. > > > The CI on Windows is blow

Re: pgsql: Remove the restriction that the relmap must be 512 bytes.

2022-07-26 Thread Thomas Munro
On Wed, Jul 27, 2022 at 4:35 PM Michael Paquier wrote: > On Tue, Jul 26, 2022 at 07:10:22PM +, Robert Haas wrote: > > Remove the restriction that the relmap must be 512 bytes. > The CI on Windows is blowing up here and there after something that > looks to come from this commit, as of this

pgsql: Remove dead getpwuid_r replacement code.

2022-07-23 Thread Thomas Munro
Remove dead getpwuid_r replacement code. getpwuid_r is in SUSv2 and all targeted Unix systems have it. We don't use it for Windows. Reviewed-by: Tom Lane Reviewed-by: Greg Stark Reviewed-by: Robert Haas Discussion:

pgsql: Remove dead handling for pre-POSIX sigwait().

2022-07-23 Thread Thomas Munro
Remove dead handling for pre-POSIX sigwait(). sigwait() is in SUSv2 and all targeted Unix systems have it. An earlier pre-standard function prototype existed on some older systems, but we no longer need a workaround for that. Reviewed-by: Tom Lane Reviewed-by: Greg Stark Reviewed-by: Robert

pgsql: Remove dead getrusage replacement code.

2022-07-23 Thread Thomas Munro
Remove dead getrusage replacement code. getrusage() is in SUSv2 and all targeted Unix systems have it. Note that POSIX only covers ru_utime and ru_stime and we rely on many more fields without any kind of configure probe, but that predates this commit. The only supported system we need

pgsql: Remove configure probe for wctype.h.

2022-07-22 Thread Thomas Munro
Remove configure probe for wctype.h. This header is present in SUSv2 and Windows. Also remove the inclusion of , following clues that it was only included for the benefit of historical systems that didn't have . Reviewed-by: Tom Lane Discussion:

pgsql: Remove configure probe for sys/tas.h.

2022-07-22 Thread Thomas Munro
Remove configure probe for sys/tas.h. The last reference to HAVE_SYS_TAS_H disappeared with commit 718aa43a. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a3b8d2a997ab6e8d982495753013c440b32929ba Modified Files -- configure | 2 +-

pgsql: Remove unnecessary Windows-specific basebackup code.

2022-07-21 Thread Thomas Munro
Remove unnecessary Windows-specific basebackup code. Commit c6f2f016 added an explicit check for a Windows "junction point". That turned out to be needed only because get_dirent_type() was busted on Windows. It's been fixed by commit 9d3444dc, so remove it. Add a TAP-test to demonstrate that

pgsql: Remove unnecessary Windows-specific basebackup code.

2022-07-21 Thread Thomas Munro
Remove unnecessary Windows-specific basebackup code. Commit c6f2f016 added an explicit check for a Windows "junction point". That turned out to be needed only because get_dirent_type() was busted on Windows. It's been fixed by commit 9d3444dc, so remove it. Add a TAP-test to demonstrate that

pgsql: Fix get_dirent_type() for Windows junction points.

2022-07-21 Thread Thomas Munro
Fix get_dirent_type() for Windows junction points. Commit 87e6ed7c8 added code that intended to report Windows "junction points" as DT_LNK (the same way we report symlinks on Unix). Windows junction points are *also* directories according to the Windows attributes API, and we were reporting them

pgsql: Fix get_dirent_type() for Windows junction points.

2022-07-21 Thread Thomas Munro
Fix get_dirent_type() for Windows junction points. Commit 87e6ed7c8 added code that intended to report Windows "junction points" as DT_LNK (the same way we report symlinks on Unix). Windows junction points are *also* directories according to the Windows attributes API, and we were reporting them

pgsql: Fix get_dirent_type() for Windows junction points.

2022-07-21 Thread Thomas Munro
Fix get_dirent_type() for Windows junction points. Commit 87e6ed7c8 added code that intended to report Windows "junction points" as DT_LNK (the same way we report symlinks on Unix). Windows junction points are *also* directories according to the Windows attributes API, and we were reporting them

pgsql: Remove O_FSYNC and associated macros.

2022-07-21 Thread Thomas Munro
Remove O_FSYNC and associated macros. O_FSYNC was a pre-POSIX way of spelling O_SYNC, supported since commit 9d645fd84c3 for non-conforming operating systems of the time. It's not needed on any modern system. We can just use standard O_SYNC directly if it exists (= all targeted systems except

pgsql: Extend size_t support in pg_bitutils.h.

2022-07-21 Thread Thomas Munro
Extend size_t support in pg_bitutils.h. Use a more compact notation that allows us to add more size_t variants as required. This will be used by a later commit. Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CA%2BhUKG%2B7dSX1XF8yFGmYk-%3D48dbjH2kmzZj16XvhbrWP-9BzRg%40mail.gmail.com

pgsql: Remove fls(), use pg_leftmost_one_pos32() instead.

2022-07-21 Thread Thomas Munro
Remove fls(), use pg_leftmost_one_pos32() instead. Commit 4f658dc8 provided the traditional BSD fls() function in src/port/fls.c so it could be used in several places. Later we added a bunch of similar facilities in pg_bitutils.h, based on compiler builtins that map to hardware instructions.

pgsql: Add wal_sync_method=fdatasync for Windows.

2022-07-20 Thread Thomas Munro
Add wal_sync_method=fdatasync for Windows. Windows 10 gained support for flushing NTFS files with fdatasync() semantics. The main advantage over open_datasync (in Windows API terms FILE_FLAG_WRITE_THROUGH) is that the latter does not flush SATA drive caches. The default setting is not changed,

pgsql: Fix warnings on Windows.

2022-07-19 Thread Thomas Munro
Fix warnings on Windows. Avoid macro redefinition warnings. Reported-by: David Rowley Discussion: https://postgr.es/m/CAApHDvocHp4SXcPeMTwFiCQGaf9JypjTJ3Bh90jcPuGwxyDjjQ%40mail.gmail.com Branch -- master Details ---

pgsql: Emulate sigprocmask(), not sigsetmask(), on Windows.

2022-07-15 Thread Thomas Munro
Emulate sigprocmask(), not sigsetmask(), on Windows. Since commit a65e0864, we've required Unix systems to have sigprocmask(). As noted in that commit's message, we were still emulating the historical pre-standard sigsetmask() function in our Windows support code. Emulate standard sigprocmask()

pgsql: Make dsm_impl_posix_resize more future-proof.

2022-07-15 Thread Thomas Munro
Make dsm_impl_posix_resize more future-proof. Commit 4518c798 blocks signals for a short region of code, but it assumed that whatever called it had the signal mask set to UnBlockSig on entry. That may be true today (or may even not be, in extensions in the wild), but it would be better not to

pgsql: Make dsm_impl_posix_resize more future-proof.

2022-07-15 Thread Thomas Munro
Make dsm_impl_posix_resize more future-proof. Commit 4518c798 blocks signals for a short region of code, but it assumed that whatever called it had the signal mask set to UnBlockSig on entry. That may be true today (or may even not be, in extensions in the wild), but it would be better not to

pgsql: Make dsm_impl_posix_resize more future-proof.

2022-07-15 Thread Thomas Munro
Make dsm_impl_posix_resize more future-proof. Commit 4518c798 blocks signals for a short region of code, but it assumed that whatever called it had the signal mask set to UnBlockSig on entry. That may be true today (or may even not be, in extensions in the wild), but it would be better not to

pgsql: Make dsm_impl_posix_resize more future-proof.

2022-07-15 Thread Thomas Munro
Make dsm_impl_posix_resize more future-proof. Commit 4518c798 blocks signals for a short region of code, but it assumed that whatever called it had the signal mask set to UnBlockSig on entry. That may be true today (or may even not be, in extensions in the wild), but it would be better not to

pgsql: Make dsm_impl_posix_resize more future-proof.

2022-07-15 Thread Thomas Munro
Make dsm_impl_posix_resize more future-proof. Commit 4518c798 blocks signals for a short region of code, but it assumed that whatever called it had the signal mask set to UnBlockSig on entry. That may be true today (or may even not be, in extensions in the wild), but it would be better not to

pgsql: Make dsm_impl_posix_resize more future-proof.

2022-07-15 Thread Thomas Munro
Make dsm_impl_posix_resize more future-proof. Commit 4518c798 blocks signals for a short region of code, but it assumed that whatever called it had the signal mask set to UnBlockSig on entry. That may be true today (or may even not be, in extensions in the wild), but it would be better not to

pgsql: Make dsm_impl_posix_resize more future-proof.

2022-07-15 Thread Thomas Munro
Make dsm_impl_posix_resize more future-proof. Commit 4518c798 blocks signals for a short region of code, but it assumed that whatever called it had the signal mask set to UnBlockSig on entry. That may be true today (or may even not be, in extensions in the wild), but it would be better not to

pgsql: Don't clobber postmaster sigmask in dsm_impl_resize.

2022-07-14 Thread Thomas Munro
Don't clobber postmaster sigmask in dsm_impl_resize. Commit 4518c798 intended to block signals in regular backends that allocate DSM segments, but dsm_impl_resize() is also reached by dsm_postmaster_startup(). It's not OK to clobber the postmaster's signal mask, so only manipulate the signal

pgsql: Don't clobber postmaster sigmask in dsm_impl_resize.

2022-07-14 Thread Thomas Munro
Don't clobber postmaster sigmask in dsm_impl_resize. Commit 4518c798 intended to block signals in regular backends that allocate DSM segments, but dsm_impl_resize() is also reached by dsm_postmaster_startup(). It's not OK to clobber the postmaster's signal mask, so only manipulate the signal

pgsql: Don't clobber postmaster sigmask in dsm_impl_resize.

2022-07-14 Thread Thomas Munro
Don't clobber postmaster sigmask in dsm_impl_resize. Commit 4518c798 intended to block signals in regular backends that allocate DSM segments, but dsm_impl_resize() is also reached by dsm_postmaster_startup(). It's not OK to clobber the postmaster's signal mask, so only manipulate the signal

pgsql: Don't clobber postmaster sigmask in dsm_impl_resize.

2022-07-14 Thread Thomas Munro
Don't clobber postmaster sigmask in dsm_impl_resize. Commit 4518c798 intended to block signals in regular backends that allocate DSM segments, but dsm_impl_resize() is also reached by dsm_postmaster_startup(). It's not OK to clobber the postmaster's signal mask, so only manipulate the signal

pgsql: Don't clobber postmaster sigmask in dsm_impl_resize.

2022-07-14 Thread Thomas Munro
Don't clobber postmaster sigmask in dsm_impl_resize. Commit 4518c798 intended to block signals in regular backends that allocate DSM segments, but dsm_impl_resize() is also reached by dsm_postmaster_startup(). It's not OK to clobber the postmaster's signal mask, so only manipulate the signal

pgsql: Don't clobber postmaster sigmask in dsm_impl_resize.

2022-07-14 Thread Thomas Munro
Don't clobber postmaster sigmask in dsm_impl_resize. Commit 4518c798 intended to block signals in regular backends that allocate DSM segments, but dsm_impl_resize() is also reached by dsm_postmaster_startup(). It's not OK to clobber the postmaster's signal mask, so only manipulate the signal

pgsql: Don't clobber postmaster sigmask in dsm_impl_resize.

2022-07-14 Thread Thomas Munro
Don't clobber postmaster sigmask in dsm_impl_resize. Commit 4518c798 intended to block signals in regular backends that allocate DSM segments, but dsm_impl_resize() is also reached by dsm_postmaster_startup(). It's not OK to clobber the postmaster's signal mask, so only manipulate the signal

pgsql: Avoid shadowing a variable in sync.c.

2022-07-14 Thread Thomas Munro
Avoid shadowing a variable in sync.c. It was confusing to reuse the variable name 'entry' in two scopes. Use distinct variable names. Reported-by: Ranier Vilela Reported-by: Tom Lane Reported-by: Kyotaro Horiguchi Discussion:

pgsql: Block signals while allocating DSM memory.

2022-07-14 Thread Thomas Munro
Block signals while allocating DSM memory. On Linux, we call posix_fallocate() on shm_open()'d memory to avoid later potential SIGBUS (see commit 899bd785). Based on field reports of systems stuck in an EINTR retry loop there, there, we made it possible to break out of that loop via slightly odd

<    1   2   3   4   5   6   7   8   9   10   >