Обсуждение: PG version is not seen in pg_upgrade test log
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
lineorder 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
Вложения
> 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
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