pgsql: Count write times when extending relation files for shared buffe

2023-10-17 Thread Michael Paquier
Count write times when extending relation files for shared buffers Relation files extended multiple blocks at a time have been counting the number of blocks written, but forgot that to increment the write time in this case, as write and relation extension are treated as two different I/O

pgsql: Count write times when extending relation files for shared buffe

2023-10-17 Thread Michael Paquier
Count write times when extending relation files for shared buffers Relation files extended by multiple blocks at a time have been counting the number of blocks written, but forgot to increment the write time in this case, as single-block write and relation extension are treated as two different

pgsql: Add flush option to pg_logical_emit_message()

2023-10-17 Thread Michael Paquier
Add flush option to pg_logical_emit_message() Since its introduction, LogLogicalMessage() (via the SQL interface pg_logical_emit_message()) has never included a call to XLogFlush(), causing it to potentially lose messages on a crash when used in non-transactional mode. This has come up to me as

pgsql: windows: msvc: Define STDIN/OUT/ERR_FILENO.

2023-10-17 Thread Nathan Bossart
windows: msvc: Define STDIN/OUT/ERR_FILENO. This commit (c290e79cf0) was originally back-patched to v15. Commit 97550c0711 added a new use of STDERR_FILENO, and it was back-patched all the way to v11, thus breaking MSVC builds for v11 through v14. Since STDERR_FILENO is now needed on older

pgsql: windows: msvc: Define STDIN/OUT/ERR_FILENO.

2023-10-17 Thread Nathan Bossart
windows: msvc: Define STDIN/OUT/ERR_FILENO. This commit (c290e79cf0) was originally back-patched to v15. Commit 97550c0711 added a new use of STDERR_FILENO, and it was back-patched all the way to v11, thus breaking MSVC builds for v11 through v14. Since STDERR_FILENO is now needed on older

pgsql: windows: msvc: Define STDIN/OUT/ERR_FILENO.

2023-10-17 Thread Nathan Bossart
windows: msvc: Define STDIN/OUT/ERR_FILENO. This commit (c290e79cf0) was originally back-patched to v15. Commit 97550c0711 added a new use of STDERR_FILENO, and it was back-patched all the way to v11, thus breaking MSVC builds for v11 through v14. Since STDERR_FILENO is now needed on older

pgsql: windows: msvc: Define STDIN/OUT/ERR_FILENO.

2023-10-17 Thread Nathan Bossart
windows: msvc: Define STDIN/OUT/ERR_FILENO. This commit (c290e79cf0) was originally back-patched to v15. Commit 97550c0711 added a new use of STDERR_FILENO, and it was back-patched all the way to v11, thus breaking MSVC builds for v11 through v14. Since STDERR_FILENO is now needed on older

pgsql: Back-patch test cases for timetz_zone/timetz_izone.

2023-10-17 Thread Tom Lane
Back-patch test cases for timetz_zone/timetz_izone. Per code coverage reports, we had zero regression test coverage of these functions. That came back to bite us, as apparently that's allowed us to miss discovering misbehavior of this code with AIX's xlc compiler. Install relevant portions of

pgsql: Back-patch test cases for timetz_zone/timetz_izone.

2023-10-17 Thread Tom Lane
Back-patch test cases for timetz_zone/timetz_izone. Per code coverage reports, we had zero regression test coverage of these functions. That came back to bite us, as apparently that's allowed us to miss discovering misbehavior of this code with AIX's xlc compiler. Install relevant portions of

pgsql: Back-patch test cases for timetz_zone/timetz_izone.

2023-10-17 Thread Tom Lane
Back-patch test cases for timetz_zone/timetz_izone. Per code coverage reports, we had zero regression test coverage of these functions. That came back to bite us, as apparently that's allowed us to miss discovering misbehavior of this code with AIX's xlc compiler. Install relevant portions of

pgsql: Back-patch test cases for timetz_zone/timetz_izone.

2023-10-17 Thread Tom Lane
Back-patch test cases for timetz_zone/timetz_izone. Per code coverage reports, we had zero regression test coverage of these functions. That came back to bite us, as apparently that's allowed us to miss discovering misbehavior of this code with AIX's xlc compiler. Install relevant portions of

pgsql: Back-patch test cases for timetz_zone/timetz_izone.

2023-10-17 Thread Tom Lane
Back-patch test cases for timetz_zone/timetz_izone. Per code coverage reports, we had zero regression test coverage of these functions. That came back to bite us, as apparently that's allowed us to miss discovering misbehavior of this code with AIX's xlc compiler. Install relevant portions of

pgsql: Back-patch test cases for timetz_zone/timetz_izone.

2023-10-17 Thread Tom Lane
Back-patch test cases for timetz_zone/timetz_izone. Per code coverage reports, we had zero regression test coverage of these functions. That came back to bite us, as apparently that's allowed us to miss discovering misbehavior of this code with AIX's xlc compiler. Install relevant portions of

pgsql: Dodge a compiler bug affecting timetz_zone/timetz_izone.

2023-10-17 Thread Tom Lane
Dodge a compiler bug affecting timetz_zone/timetz_izone. Use a modulo operator instead of implementing the same behavior with a loop. The loop solution is doubtless microscopically faster for the typical case of only wrapping into the very next day, but maybe not so much for large interval

pgsql: Avoid calling proc_exit() in processes forked by system().

2023-10-17 Thread Nathan Bossart
Avoid calling proc_exit() in processes forked by system(). The SIGTERM handler for the startup process immediately calls proc_exit() for the duration of the restore_command, i.e., a call to system(). This system() call forks a new process to execute the shell command, and this child process

pgsql: Avoid calling proc_exit() in processes forked by system().

2023-10-17 Thread Nathan Bossart
Avoid calling proc_exit() in processes forked by system(). The SIGTERM handler for the startup process immediately calls proc_exit() for the duration of the restore_command, i.e., a call to system(). This system() call forks a new process to execute the shell command, and this child process

pgsql: Avoid calling proc_exit() in processes forked by system().

2023-10-17 Thread Nathan Bossart
Avoid calling proc_exit() in processes forked by system(). The SIGTERM handler for the startup process immediately calls proc_exit() for the duration of the restore_command, i.e., a call to system(). This system() call forks a new process to execute the shell command, and this child process

pgsql: Avoid calling proc_exit() in processes forked by system().

2023-10-17 Thread Nathan Bossart
Avoid calling proc_exit() in processes forked by system(). The SIGTERM handler for the startup process immediately calls proc_exit() for the duration of the restore_command, i.e., a call to system(). This system() call forks a new process to execute the shell command, and this child process

pgsql: Avoid calling proc_exit() in processes forked by system().

2023-10-17 Thread Nathan Bossart
Avoid calling proc_exit() in processes forked by system(). The SIGTERM handler for the startup process immediately calls proc_exit() for the duration of the restore_command, i.e., a call to system(). This system() call forks a new process to execute the shell command, and this child process

pgsql: Avoid calling proc_exit() in processes forked by system().

2023-10-17 Thread Nathan Bossart
Avoid calling proc_exit() in processes forked by system(). The SIGTERM handler for the startup process immediately calls proc_exit() for the duration of the restore_command, i.e., a call to system(). This system() call forks a new process to execute the shell command, and this child process

pgsql: Avoid calling proc_exit() in processes forked by system().

2023-10-17 Thread Nathan Bossart
Avoid calling proc_exit() in processes forked by system(). The SIGTERM handler for the startup process immediately calls proc_exit() for the duration of the restore_command, i.e., a call to system(). This system() call forks a new process to execute the shell command, and this child process

pgsql: Reword messages about impending (M)XID exhaustion.

2023-10-17 Thread Robert Haas
Reword messages about impending (M)XID exhaustion. First, we shouldn't recommend switching to single-user mode, because that's terrible advice. Especially on newer versions where VACUUM will enter emergency mode when nearing (M)XID exhaustion, it's perfectly fine to just VACUUM in multi-user

pgsql: Talk about assigning, rather than generating, new MultiXactIds.

2023-10-17 Thread Robert Haas
Talk about assigning, rather than generating, new MultiXactIds. The word "assign" is used in various places internally to describe what GetNewMultiXactId does, but the user-facing messages have previously said "generate". For consistency, standardize on "assign," which seems (at least to me) to