PG version is not seen in pg_upgrade test log

Started by Potapov Alexander5 months ago6 messageshackers
Jump to latest
#1Potapov Alexander
a.potapov@postgrespro.com

Hello!

I ran pg_upgrade tests (make check -C src/bin/pg_upgrade) and found that test log does not contain PG version:
(file: src/bin/pg_upgrade/tmp_check/log/regress_log_002_pg_upgrade)
Name: old_node
Data directory: /home/dev/code/postgrespro3/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_old_node_data/pgdata
Backup directory: /home/dev/code/postgrespro3/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_old_node_data/backup
This happens because $node->_set_pg_version is called after invocation of $node->dump_info. To fix it we should change line order in Cluster.pm file. The result looks like:
Name: old_node
Version: 19devel
Data directory: /home/dev/code/postgrespro3/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_old_node_data/pgdata
Backup directory: /home/dev/code/postgrespro3/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_old_node_data/backup

The change I suggest is:
   --- a/src/test/perl/PostgreSQL/Test/Cluster.pm
   +++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
   @@ -1647,10 +1647,10 @@ sub new
           or
           BAIL_OUT("could not create data directory \"$node->{_basedir}\": $!");
   -    $node->dump_info;
   -
       $node->_set_pg_version;
   +    $node->dump_info;
   +
       my $ver = $node->{_pg_version};

Patch attached.

Best regards,
Alexander Potapov

Attachments:

0001-Show-PG-version-in-pg_upgrade-test-log.patchapplication/octet-streamDownload+2-3
#2Daniel Gustafsson
daniel@yesql.se
In reply to: Potapov Alexander (#1)
Re: PG version is not seen in pg_upgrade test log

On 30 Nov 2025, at 10:11, Potapov Alexander <a.potapov@postgrespro.com> wrote:

I ran pg_upgrade tests (make check -C src/bin/pg_upgrade) and found that test log does not contain PG version:

-    $node->dump_info;
-
$node->_set_pg_version;
+    $node->dump_info;
+

This seems like a correct change, reading the history around this code makes it
seem like it just happened to end up in the wrong place in one of many
refactorings.

--
Daniel Gustafsson

#3Michael Paquier
michael@paquier.xyz
In reply to: Daniel Gustafsson (#2)
Re: PG version is not seen in pg_upgrade test log

On Tue, Dec 02, 2025 at 11:22:36AM +0100, Daniel Gustafsson wrote:

This seems like a correct change, reading the history around this code makes it
seem like it just happened to end up in the wrong place in one of many
refactorings.

Indeed. It looks like this should be backpatched down to v15 for two
reasons: Cluster.pm exists since v15 and pg_upgrade has been converted
to TAP since v15.
--
Michael

#4Potapov Alexander
a.potapov@postgrespro.com
In reply to: Michael Paquier (#3)
Re: PG version is not seen in pg_upgrade test log

Indeed. It looks like this should be backpatched down to v15 for two
reasons: Cluster.pm exists since v15 and pg_upgrade has been converted
to TAP since v15.

I rebased the patch to be up-to-date with master.
--
Alexander

#5Potapov Alexander
a.potapov@postgrespro.com
In reply to: Potapov Alexander (#4)
Re: PG version is not seen in pg_upgrade test log

Updated patch attached.

Attachments:

0001-Show-PG-version-in-pg_upgrade-test-log.patchapplication/octet-streamDownload+2-3
#6Michael Paquier
michael@paquier.xyz
In reply to: Potapov Alexander (#5)
Re: PG version is not seen in pg_upgrade test log

On Thu, Dec 04, 2025 at 10:26:01AM +0300, Potapov Alexander wrote:

Updated patch attached.

Applied that down to v15. Thanks.
--
Michael