pgsql: Fix concurrency issues with WAL segment recycling on Windows

2021-03-21 Thread Michael Paquier
Fix concurrency issues with WAL segment recycling on Windows This commit is mostly a revert of aaa3aed, that switched the routine doing the internal renaming of recycled WAL segments to use on Windows a combination of CreateHardLinkA() plus unlink() instead of rename(). As reported by several use

pgsql: Fix concurrency issues with WAL segment recycling on Windows

2021-03-21 Thread Michael Paquier
Fix concurrency issues with WAL segment recycling on Windows This commit is mostly a revert of aaa3aed, that switched the routine doing the internal renaming of recycled WAL segments to use on Windows a combination of CreateHardLinkA() plus unlink() instead of rename(). As reported by several use

pgsql: pgbench: Improve error-handling in \sleep command.

2021-03-21 Thread Fujii Masao
pgbench: Improve error-handling in \sleep command. This commit improves pgbench \sleep command so that it handles the following three cases more properly. (1) When only one argument was specified in \sleep command and it's not a number, previously pgbench reported a confusing error messag

pgsql: Make a test endure log_error_verbosity=verbose.

2021-03-21 Thread Noah Misch
Make a test endure log_error_verbosity=verbose. Back-patch to v13, which introduced the test code in question. Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/48664e41688ca113e01b7055d41957c600e565ca Modified Files -- src/test/recovery/t/003_reco

pgsql: Make a test endure log_error_verbosity=verbose.

2021-03-21 Thread Noah Misch
Make a test endure log_error_verbosity=verbose. Back-patch to v13, which introduced the test code in question. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e3f4aec027891f794328050e62c9bbbe4ae02811 Modified Files -- src/test/recovery/t/003_recovery_ta

pgsql: Fix new TAP test for 2PC transactions and PITRs on Windows

2021-03-21 Thread Michael Paquier
Fix new TAP test for 2PC transactions and PITRs on Windows The test added by 595b9cb forgot that on Windows it is necessary to set up pg_hba.conf (see PostgresNode::set_replication_conf) with a specific entry or base backups fail. Any node that requires to support replication just needs to pass d

pgsql: Fix new TAP test for 2PC transactions and PITRs on Windows

2021-03-21 Thread Michael Paquier
Fix new TAP test for 2PC transactions and PITRs on Windows The test added by 595b9cb forgot that on Windows it is necessary to set up pg_hba.conf (see PostgresNode::set_replication_conf) with a specific entry or base backups fail. Any node that requires to support replication just needs to pass d

pgsql: Fix new TAP test for 2PC transactions and PITRs on Windows

2021-03-21 Thread Michael Paquier
Fix new TAP test for 2PC transactions and PITRs on Windows The test added by 595b9cb forgot that on Windows it is necessary to set up pg_hba.conf (see PostgresNode::set_replication_conf) with a specific entry or base backups fail. Any node that requires to support replication just needs to pass d

pgsql: Fix new TAP test for 2PC transactions and PITRs on Windows

2021-03-21 Thread Michael Paquier
Fix new TAP test for 2PC transactions and PITRs on Windows The test added by 595b9cb forgot that on Windows it is necessary to set up pg_hba.conf (see PostgresNode::set_replication_conf) with a specific entry or base backups fail. Any node that requires to support replication just needs to pass d

pgsql: Fix new TAP test for 2PC transactions and PITRs on Windows

2021-03-21 Thread Michael Paquier
Fix new TAP test for 2PC transactions and PITRs on Windows The test added by 595b9cb forgot that on Windows it is necessary to set up pg_hba.conf (see PostgresNode::set_replication_conf) with a specific entry or base backups fail. Any node that requires to support replication just needs to pass d

pgsql: Simplify TAP tests of kerberos with expected log file contents

2021-03-21 Thread Michael Paquier
Simplify TAP tests of kerberos with expected log file contents The TAP tests of kerberos rely on the logs generated by the backend to check various connection scenarios. In order to make sure that a given test does not overlap with the log contents generated by a previous test, the test suite rel

pgsql: Fix timeline assignment in checkpoints with 2PC transactions

2021-03-21 Thread Michael Paquier
Fix timeline assignment in checkpoints with 2PC transactions Any transactions found as still prepared by a checkpoint have their state data read from the WAL records generated by PREPARE TRANSACTION before being moved into their new location within pg_twophase/. While reading such records, the WA

pgsql: Fix timeline assignment in checkpoints with 2PC transactions

2021-03-21 Thread Michael Paquier
Fix timeline assignment in checkpoints with 2PC transactions Any transactions found as still prepared by a checkpoint have their state data read from the WAL records generated by PREPARE TRANSACTION before being moved into their new location within pg_twophase/. While reading such records, the WA

pgsql: Fix timeline assignment in checkpoints with 2PC transactions

2021-03-21 Thread Michael Paquier
Fix timeline assignment in checkpoints with 2PC transactions Any transactions found as still prepared by a checkpoint have their state data read from the WAL records generated by PREPARE TRANSACTION before being moved into their new location within pg_twophase/. While reading such records, the WA

pgsql: Fix timeline assignment in checkpoints with 2PC transactions

2021-03-21 Thread Michael Paquier
Fix timeline assignment in checkpoints with 2PC transactions Any transactions found as still prepared by a checkpoint have their state data read from the WAL records generated by PREPARE TRANSACTION before being moved into their new location within pg_twophase/. While reading such records, the WA

pgsql: Fix timeline assignment in checkpoints with 2PC transactions

2021-03-21 Thread Michael Paquier
Fix timeline assignment in checkpoints with 2PC transactions Any transactions found as still prepared by a checkpoint have their state data read from the WAL records generated by PREPARE TRANSACTION before being moved into their new location within pg_twophase/. While reading such records, the WA

pgsql: Fix assorted silliness in ATExecSetCompression().

2021-03-21 Thread Tom Lane
Fix assorted silliness in ATExecSetCompression(). It's not okay to scribble directly on a syscache entry. Nor to continue accessing said entry after releasing it. Also get rid of not-used local variables. Per valgrind testing. Branch -- master Details --- https://git.postgresql.org/pg/

pgsql: Recycle nbtree pages deleted during same VACUUM.

2021-03-21 Thread Peter Geoghegan
Recycle nbtree pages deleted during same VACUUM. Maintain a simple array of metadata about pages that were deleted during nbtree VACUUM's current btvacuumscan() call. Use this metadata at the end of btvacuumscan() to attempt to place newly deleted pages in the FSM without further delay. It might

pgsql: Bring configure support for LZ4 up to snuff.

2021-03-21 Thread Tom Lane
Bring configure support for LZ4 up to snuff. It's not okay to just shove the pkg_config results right into our build flags, for a couple different reasons: * This fails to maintain the separation between CPPFLAGS and CFLAGS, as well as that between LDFLAGS and LIBS. (The CPPFLAGS angle is, I bel

pgsql: Make compression.sql regression test independent of default.

2021-03-21 Thread Tom Lane
Make compression.sql regression test independent of default. This test will fail in "make installcheck" if the installation's default_toast_compression setting is not 'pglz'. Make it robust against that situation. Dilip Kumar Discussion: https://postgr.es/m/CAFiTN-t0w+Rc2U3S+y=7kwcluoynb5mfweg

pgsql: Don't run recover crash_temp_files test in Windows perl

2021-03-21 Thread Andrew Dunstan
Don't run recover crash_temp_files test in Windows perl This reverts commit 677271a3a125e294b33b891669f594a2c8cb36ce. "Unbreak recovery test on Windows" The test hangs on Windows, and attempts to remedy the problem have proved fragile at best. So we simply disable the test on Windows perl. (Msys

Re: pgsql: Unbreak recovery test on Windows

2021-03-21 Thread Andrew Dunstan
On 3/21/21 2:16 PM, Tom Lane wrote: > Andrew Dunstan writes: >> Ugh.  Is there any reason we need to do those kills before we end the >> psql processes? If not I'm tempted just to move them - after the psql's >> are finished it should be safe. At any rate I'll go and test that. > IIUC, that'd co

Re: pgsql: Unbreak recovery test on Windows

2021-03-21 Thread Tom Lane
Andrew Dunstan writes: > Ugh.  Is there any reason we need to do those kills before we end the > psql processes? If not I'm tempted just to move them - after the psql's > are finished it should be safe. At any rate I'll go and test that. IIUC, that'd completely destroy the point of the test, whic

pgsql: Fix new memory leaks in libpq

2021-03-21 Thread Alvaro Herrera
Fix new memory leaks in libpq My oversight in commit 9aa491abbf07. Per coverity. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2b526ed2e1cbaa54e5ad0c12d1294482f2757b17 Modified Files -- src/interfaces/libpq/fe-exec.c | 9 + 1 file changed, 5 i

Re: pgsql: Unbreak recovery test on Windows

2021-03-21 Thread Andrew Dunstan
On 3/21/21 1:06 PM, Andrew Dunstan wrote: > On 3/21/21 12:38 PM, Tom Lane wrote: >> Andrew Dunstan writes: >>> Unbreak recovery test on Windows >> Hmm, looks like this broke things on other machines. >> crake and sifaka (so far) are showing >> >> # Running: pg_ctl kill KILL 2237831 >> ok 3 - kil

Re: pgsql: Unbreak recovery test on Windows

2021-03-21 Thread Andrew Dunstan
On 3/21/21 12:38 PM, Tom Lane wrote: > Andrew Dunstan writes: >> Unbreak recovery test on Windows > Hmm, looks like this broke things on other machines. > crake and sifaka (so far) are showing > > # Running: pg_ctl kill KILL 2237831 > ok 3 - killed process with KILL > ack Broken pipe: write( 13,

Re: pgsql: Unbreak recovery test on Windows

2021-03-21 Thread Tom Lane
Andrew Dunstan writes: > Unbreak recovery test on Windows Hmm, looks like this broke things on other machines. crake and sifaka (so far) are showing # Running: pg_ctl kill KILL 2237831 ok 3 - killed process with KILL ack Broken pipe: write( 13, '\\q ' ) at /usr/share/perl5/vendor_perl/IPC/Run/IO

pgsql: Unbreak recovery test on Windows

2021-03-21 Thread Andrew Dunstan
Unbreak recovery test on Windows On Windows we need to send explicit quit messages to psql or the TAP tests can hang. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/677271a3a125e294b33b891669f594a2c8cb36ce Modified Files -- src/test/recovery/t/022_cras

pgsql: Suppress various new compiler warnings.

2021-03-21 Thread Tom Lane
Suppress various new compiler warnings. Compilers that don't understand that elog(ERROR) doesn't return issued warnings here. In the cases in libpq_pipeline.c, we were not exactly helping things by failing to mark pg_fatal() as noreturn. Per buildfarm. Branch -- master Details --- http

pgsql: Move lwlock-release probe back where it belongs

2021-03-21 Thread Peter Eisentraut
Move lwlock-release probe back where it belongs The documentation specifically states that lwlock-release fires before any released waiters have been awakened. It worked that way until ab5194e6f617a9a9e7aadb3dd1cee948a42d0755, where is seems to have been misplaced accidentally. Move it back wher