postgres.git / summary / log / commit / refs

commit    ac1ccbea98f166548890f14c9ca9d4ab055ca291
Author:   Michael Paquier <michael@paquier.xyz>
Date:     Fri Sep 04 06:51:56 2026 +0000

    pg_upgrade: Skip tests for live server checks on Windows
    
    The tests added by 88aa6ca138a1 could fail on Windows, due to the fact
    that pg_ctl is not able to compare the PID stored in postmaster.pid with
    the postmaster that has been spawned.  The postmaster may not be seen as
    running, and could fail the live check.
    
    Note that pg_ctl falls back on checking the start time recorded in
    postmaster.pid, with a lag of 2 seconds.  So, outside the possibility of
    fixing pg_ctl so as the PID file checks become more reliable, an
    alternative solution would be to use the same trick as the pg_ctl test
    001_start_stop.pl, with a hardcoded sleep of *3* seconds, at least.  I
    cannot get excited about spreading this pattern, though, so skip it is
    as we do not lose any coverage.
    
    Per report from buildfarm members fairywren.
    
    Discussion: https://postgr.es/m/apphYnTYS1WtLkKU@paquier.xyz


src/bin/pg_upgrade/t/002_pg_upgrade.pl | 73 +++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index a0bc51f3292..a5cfd53265d 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -480,41 +480,48 @@ if (defined($ENV{oldinstall})) # in it, like delete_old_cluster.{sh,bat}. chdir ${PostgreSQL::Test::Utils::tmp_check}; -my @live_check_command = ( - 'pg_upgrade', '--no-sync', - '--old-datadir' => $oldnode->data_dir, - '--new-datadir' => $newnode->data_dir, - '--old-bindir' => $oldbindir, - '--new-bindir' => $newbindir, - '--socketdir' => $newnode->host, - '--old-port' => $oldnode->port); - -# A live check must use different ports for the running old server and -# the temporary new server. -command_checks_all( - [ - @live_check_command, - '--new-port' => $oldnode->port, - $mode, '--check', - ], - 1, - [ - qr/When checking a live server, the old and new port numbers must be different\./ - ], - [], - 'pg_upgrade --check with the same old and new ports'); +# Checks with the old server still running. +SKIP: +{ + skip "Timing issues with live server detection on Windows", 5 + if ($windows_os); -rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + my @live_check_command = ( + 'pg_upgrade', '--no-sync', + '--old-datadir' => $oldnode->data_dir, + '--new-datadir' => $newnode->data_dir, + '--old-bindir' => $oldbindir, + '--new-bindir' => $newbindir, + '--socketdir' => $newnode->host, + '--old-port' => $oldnode->port); -# Check the old cluster while it is running. -command_like( - [ - @live_check_command, - '--new-port' => $newnode->port, - $mode, '--check', - ], - qr/Performing Consistency Checks on Old Live Server/, - 'run of pg_upgrade --check with old instance running'); + # A live check must use different ports for the running old server and + # the temporary new server. + command_checks_all( + [ + @live_check_command, + '--new-port' => $oldnode->port, + $mode, '--check', + ], + 1, + [ + qr/When checking a live server, the old and new port numbers must be different\./ + ], + [], + 'pg_upgrade --check with the same old and new ports'); + + rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + + # Check the old cluster while it is running. + command_like( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + qr/Performing Consistency Checks on Old Live Server/, + 'run of pg_upgrade --check with old instance running'); +} # Create an invalid database, will be deleted below $oldnode->safe_psql(