agora inbox for pgsql-hackers@postgresql.orghelp / color / mirror / Atom feed
[PATCH v1 1/2] pg_upgrade: Test --check with a running source server 90+ messages / 2 participants [nested] [flat]
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v1 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/... --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 53 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..9b904a8d1ea 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,46 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +rmtree($newnode->data_dir . "/pg_upgrade_output.d"); + +# Check the old cluster while it is running. +command_ok( + [ + @live_check_command, + '--new-port' => $newnode->port, + $mode, '--check', + ], + 'run of pg_upgrade --check with old instance running'); + # Create an invalid database, will be deleted below $oldnode->safe_psql( 'postgres', qq( @@ -482,11 +522,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --cPum+Eb+s0rOlekU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* [PATCH v2 1/2] pg_upgrade: Test --check with a running source server @ 2026-08-31 03:03 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 03:03 UTC (permalink / raw) Commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. Add coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. Also test that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/apU4/hmRv/4gv20W%40bdtpg --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 46 ++++++++++++++++++++--- src/bin/pg_upgrade/t/003_logical_slots.pl | 13 +++++++ 2 files changed, 54 insertions(+), 5 deletions(-) 100.0% src/bin/pg_upgrade/t/ diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 0a4121fdc4d..a0bc51f3292 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -475,6 +475,47 @@ if (defined($ENV{oldinstall})) } } +# In a VPATH build, we'll be started in the source directory, but we want +# to run pg_upgrade in the build directory so that any files generated finish +# 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'); + +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( 'postgres', qq( @@ -482,11 +523,6 @@ $oldnode->safe_psql( UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -# In a VPATH build, we'll be started in the source directory, but we want -# to run pg_upgrade in the build directory so that any files generated finish -# in it, like delete_old_cluster.{sh,bat}. -chdir ${PostgreSQL::Test::Utils::tmp_check}; - # Upgrade the instance. $oldnode->stop; diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 01ab82402ae..b0ebf845747 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -158,6 +158,19 @@ $oldpub->safe_psql( SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message', true); SELECT pg_replication_slot_advance('test_slot3', pg_current_wal_lsn()); ]); + +# Sleep here because Windows builds cannot check postmaster.pid exactly, +# so they may mistake a pre-existing postmaster.pid for one created by the +# postmaster they start. Waiting more than the 2 seconds slop time allowed +# by wait_for_postmaster_start() prevents that mistake. +sleep 3 if ($windows_os); + +# A live check cannot require slots to have consumed all WAL because the old +# server can generate more WAL concurrently. Verify that these slots are accepted +# now. The check below verifies rejection after shutdown. +command_ok([ @pg_upgrade_cmd, '--check' ], + 'pg_upgrade --check with live old cluster and unconsumed WAL'); + $oldpub->stop; # pg_upgrade will fail because there are slots still having unconsumed WAL -- 2.34.1 --Iv49dcxIGoH7n1uf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-Fix-outdated-function-name-in-001_start_stop.pl.patch" ^ permalink raw reply [nested|flat] 90+ messages in thread
* pg_upgrade: Test --check with a running source server @ 2026-08-31 08:19 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 1 reply; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 08:19 UTC (permalink / raw) To: pgsql-hackers@lists.postgresql.org; +Cc: Michael Paquier <michael@paquier.xyz> Hi hackers, While doing some tests for [0], I noticed that we don't have coverage for pg_upgrade --check with a running source server. Indeed, commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only after stopping the source server. 0001 attached adds coverage with the source still running. This covers live server detection, connection details from postmaster.pid, control data from pg_controldata, reuse of the running postmaster, and the requirement for different source and target ports. It also tests that logical slots with unconsumed WAL are accepted during a live check. The existing offline check verifies that the same slots are rejected after shutdown. Remarks: 1/ my CI was failing on Windows (at the new 003_logical_slots.pl test) for the same reason why a sleep is part of 001_start_stop.pl. So adding the same comment and sleep in 003_logical_slots.pl too. 2/ while at 1/ I observed the comment in 001_start_stop.pl was using a stale function name. 0002 fixes it. 3/ the proposed tests would have had catch === 2 mentioned in [0]. [0]: https://postgr.es/m/apUL3N4IE934qJ08%40bdtpg Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com Attachments: [text/x-diff] v1-0001-pg_upgrade-Test-check-with-a-running-source-serve.patch (0B, ../../apU4%2FhmRv%2F4gv20W@bdtpg/2-v1-0001-pg_upgrade-Test-check-with-a-running-source-serve.patch) download ^ permalink raw reply [nested|flat] 90+ messages in thread
* Re: pg_upgrade: Test --check with a running source server @ 2026-08-31 10:54 Ewan Young <kdbase.hack@gmail.com> parent: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 1 reply; 90+ messages in thread From: Ewan Young @ 2026-08-31 10:54 UTC (permalink / raw) To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>; +Cc: pgsql-hackers@lists.postgresql.org, Michael Paquier <michael@paquier.xyz> On Mon, Aug 31, 2026 at 4:19 PM Bertrand Drouvot <bertranddrouvot.pg@gmail.com> wrote: > > Hi hackers, > > While doing some tests for [0], I noticed that we don't have coverage for > pg_upgrade --check with a running source server. > > Indeed, commit 4fff78f009 added TAP coverage for pg_upgrade --check, but only > after stopping the source server. > > 0001 attached adds coverage with the source still running. This covers live server > detection, connection details from postmaster.pid, control data from pg_controldata, > reuse of the running postmaster, and the requirement for different source and target > ports. > > It also tests that logical slots with unconsumed WAL are accepted during a live > check. The existing offline check verifies that the same slots are rejected after > shutdown. > > Remarks: > > 1/ my CI was failing on Windows (at the new 003_logical_slots.pl test) for the > same reason why a sleep is part of 001_start_stop.pl. So adding the same comment > and sleep in 003_logical_slots.pl too. > > 2/ while at 1/ I observed the comment in 001_start_stop.pl was using a stale > function name. 0002 fixes it. > > 3/ the proposed tests would have had catch === 2 mentioned in [0]. Thanks for the patches. I had a look at both patches. One optional thought on the success case in 002: command_like() matching the live-mode banner would be a bit more precise than command_ok(), since exit code 0 alone can't tell a live check from an offline one (against a stopped old server, pg_upgrade would start it itself and succeed just the same): command_like(..., qr/Performing Consistency Checks on Old Live Server/, ...) 0002 looks good: a745b936507 did rename wait_for_postmaster() to wait_for_postmaster_start(), and it shows the line you're fixing is the only stale reference left in the tree. > > [0]: https://postgr.es/m/apUL3N4IE934qJ08%40bdtpg > > Regards, > > -- > Bertrand Drouvot > PostgreSQL Contributors Team > RDS Open Source Databases > Amazon Web Services: https://aws.amazon.com -- Regards, Ewan Young ^ permalink raw reply [nested|flat] 90+ messages in thread
* Re: pg_upgrade: Test --check with a running source server @ 2026-08-31 11:27 Bertrand Drouvot <bertranddrouvot.pg@gmail.com> parent: Ewan Young <kdbase.hack@gmail.com> 0 siblings, 1 reply; 90+ messages in thread From: Bertrand Drouvot @ 2026-08-31 11:27 UTC (permalink / raw) To: Ewan Young <kdbase.hack@gmail.com>; +Cc: pgsql-hackers@lists.postgresql.org, Michael Paquier <michael@paquier.xyz> Hi, On Mon, Aug 31, 2026 at 06:54:52PM +0800, Ewan Young wrote: > On Mon, Aug 31, 2026 at 4:19 PM Bertrand Drouvot > <bertranddrouvot.pg@gmail.com> wrote: > > 0001 attached adds coverage with the source still running. This covers live server > > detection, connection details from postmaster.pid, control data from pg_controldata, > > reuse of the running postmaster, and the requirement for different source and target > > ports. > > Thanks for the patches. I had a look at both patches. Thanks! > One optional thought on the success case in 002: command_like() > matching the live-mode banner would be a bit more precise than > command_ok(), since exit code 0 alone can't tell a live check from an > offline one (against a stopped old server, pg_upgrade would start it > itself and succeed just the same): > > command_like(..., qr/Performing Consistency Checks on Old Live Server/, ...) The preceding test already proves that live mode is selected by checking that using the same port error, which is specific to live checks. That said, matching the banner makes it self contained, so changed it that way in the attached v2. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com Attachments: [text/x-diff] v2-0001-pg_upgrade-Test-check-with-a-running-source-serve.patch (0B, ../../apVlC6auNuqnuhKD@bdtpg/2-v2-0001-pg_upgrade-Test-check-with-a-running-source-serve.patch) download ^ permalink raw reply [nested|flat] 90+ messages in thread
* Re: pg_upgrade: Test --check with a running source server @ 2026-09-01 08:20 Ewan Young <kdbase.hack@gmail.com> parent: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 0 siblings, 0 replies; 90+ messages in thread From: Ewan Young @ 2026-09-01 08:20 UTC (permalink / raw) To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>; +Cc: pgsql-hackers@lists.postgresql.org, Michael Paquier <michael@paquier.xyz> On Mon, Aug 31, 2026 at 7:27 PM Bertrand Drouvot <bertranddrouvot.pg@gmail.com> wrote: > > Hi, > > On Mon, Aug 31, 2026 at 06:54:52PM +0800, Ewan Young wrote: > > On Mon, Aug 31, 2026 at 4:19 PM Bertrand Drouvot > > <bertranddrouvot.pg@gmail.com> wrote: > > > 0001 attached adds coverage with the source still running. This covers live server > > > detection, connection details from postmaster.pid, control data from pg_controldata, > > > reuse of the running postmaster, and the requirement for different source and target > > > ports. > > > > Thanks for the patches. I had a look at both patches. > > Thanks! > > > One optional thought on the success case in 002: command_like() > > matching the live-mode banner would be a bit more precise than > > command_ok(), since exit code 0 alone can't tell a live check from an > > offline one (against a stopped old server, pg_upgrade would start it > > itself and succeed just the same): > > > > command_like(..., qr/Performing Consistency Checks on Old Live Server/, ...) > > The preceding test already proves that live mode is selected by checking that > using the same port error, which is specific to live checks. That said, matching > the banner makes it self contained, so changed it that way in the attached v2. Fair point -- and thanks for the new version (and the credit). v2 looks good to me. Re-tested both patches on top of current master: the pg_upgrade and pg_ctl TAP suites pass, including the no-stderr check that command_like() adds. Nothing more from me. > > Regards, > > -- > Bertrand Drouvot > PostgreSQL Contributors Team > RDS Open Source Databases > Amazon Web Services: https://aws.amazon.com -- Regards, Ewan Young ^ permalink raw reply [nested|flat] 90+ messages in thread
end of thread, other threads:[~2026-09-01 08:20 UTC | newest] Thread overview: 90+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v1 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 03:03 [PATCH v2 1/2] pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 08:19 pg_upgrade: Test --check with a running source server Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-08-31 10:54 ` Ewan Young <kdbase.hack@gmail.com> 2026-08-31 11:27 ` Bertrand Drouvot <bertranddrouvot.pg@gmail.com> 2026-09-01 08:20 ` Ewan Young <kdbase.hack@gmail.com>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox