From 04c4c1c3a9636bb33875c039948795d7cd0da507 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Wed, 16 Sep 2026 10:28:44 +0900 Subject: [PATCH] pg_upgrade: Run test suite with initial OID higher than UINT32_MAX The test already used a pg_resetwal to bump the initial OID to be higher than UINT32_MAX after the main regression test suite has been run, to check that pg_upgrade was able to carry an 8-byte wide value. This now happens set much earlier in the script, before running the main regression test suite. A small oid8-related check is added, while on it. Perhaps this could be expanded to more objects and/or patterns later on. It should be good enough as a starting point. Author: Michael Paquier Reviewed-by: Greg Burd Reviewed-by: Bharath Rupireddy Discussion: https://postgr.es/m/aqd_gYs35v--sVlR@paquier.xyz --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 42 +++++++++++++++++--------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 728fd6b0b12..9590625fc32 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -229,6 +229,21 @@ $oldnode->append_conf('postgresql.conf', 'log_statement = none'); # Set wal_level = replica to run the regression tests in the same # wal_level as when 'make check' runs. $oldnode->append_conf('postgresql.conf', 'wal_level = replica'); + +# The OID counter is 8 bytes wide, check that it is carried across the +# test. Older versions may not support 8-byte OIDs, so skip in this case. +my $big_next_oid = '4295067296'; # 2^32 + 100000 +if (!defined($ENV{oldinstall})) +{ + command_ok( + [ + 'pg_resetwal', + '--next-oid' => $big_next_oid, + $oldnode->data_dir + ], + 'set an 8-byte OID counter in the old instance'); +} + $oldnode->start; my $result; @@ -296,6 +311,19 @@ else 'regression tests in old instance'); } +# Checks for 8-byte OIDs +if (!defined($ENV{olddump})) +{ + # Table with 8-byte OID values, past 2^32. toasttest_oid8 is + # defined in strings.sql. + is( $oldnode->safe_psql( + 'regression', + "SELECT max(pg_column_toast_chunk_id(f1)) > '$big_next_oid'::oid8 FROM toasttest_oid8" + ), + 't', + 'oid8 chunk_ids are past 2^32'); +} + # Initialize a new node for the upgrade. my $newnode = PostgreSQL::Test::Cluster->new('new_node'); @@ -588,20 +616,6 @@ $oldnode->start; $oldnode->safe_psql('postgres', 'DROP DATABASE regression_invalid'); $oldnode->stop; -# The OID counter is 8 bytes wide, check that it is carried. Older versions -# may not support 8-byte OIDs, so skip in this case. -my $big_next_oid = '4295067296'; # 2^32 + 100000 -if (!defined($ENV{oldinstall})) -{ - command_ok( - [ - 'pg_resetwal', - '--next-oid' => $big_next_oid, - $oldnode->data_dir - ], - 'set an 8-byte OID counter in the old instance'); -} - # --check command works here, cleans up pg_upgrade_output.d. command_ok( [