Re: pgsql: Trial fix for old cross-version upgrades. - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Trial fix for old cross-version upgrades.
Date
Msg-id 3815127.1740189601@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Trial fix for old cross-version upgrades.  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: pgsql: Trial fix for old cross-version upgrades.
List pgsql-committers
Jeff Davis <pgsql@j-davis.com> writes:
> The version that I committed had the following change to
> 002_pg_upgrade.pl:

>   # Stabilize stats before pg_dumpall.
>   $oldnode->append_conf('postgresql.conf', 'autovacuum = off');
>   $oldnode->restart;

>   ...

>   $newnode->append_conf('postgresql.conf', 'autovacuum = off');

> I think we need a similar change in the buildfarm client's
> TestUpgradeXversion.pm? Is -hackers the right place to discuss that?

I think we might indeed want that, but it doesn't seem to be the
explanation for the buildfarm failures, because the diffs look
to be consistent across runs which you'd not expect from
autovacuum-driven changes.  I suspect that the problem is that
pg_dump is interpreting old-version stats in some way that doesn't
match up with what we get from restoring the dump.

I did experiment with the attached very-quick-n-dirty patch, which
should succeed in suppressing autovacuum in both the old and new
versions if I understand the code correctly (which I might well not).
It made no difference at all in the dump diffs ...

            regards, tom lane

--- PGBuild/Modules/TestUpgradeXversion.pm~    2024-11-02 01:47:21.000000000 -0400
+++ PGBuild/Modules/TestUpgradeXversion.pm    2025-02-21 20:50:35.705564091 -0500
@@ -419,7 +419,7 @@ sub test_upgrade    ## no critic (Subrou
     # run in which it was set up, which will be gone by now, so we repoint
     # it to the current run's tmpdir.
     # listen_addresses will be set correctly and requires no adjustment.
-    if (!$using_localhost)
+    # In any case, disable autovacuum to prevent stats changing under us.
     {
         my $tdir = $tmpdir;
         $tdir =~ s!\\!/!g;
@@ -431,7 +431,9 @@ sub test_upgrade    ## no critic (Subrou
         $param = "unix_socket_directory"
           if $oversion ne 'HEAD' && $oversion lt 'REL9_3_STABLE';
         print $opgconf "\n# Configuration added by buildfarm client\n\n";
-        print $opgconf "$param = '$tdir'\n";
+        print $opgconf "$param = '$tdir'\n"
+            if (!$using_localhost);
+        print $opgconf "autovacuum = off\n";
         close($opgconf);
     }

@@ -507,7 +509,7 @@ sub test_upgrade    ## no critic (Subrou
           . qq{> "$upgrade_loc/$oversion-initdb.log" 2>&1});
     return if $?;

-    unless ($using_localhost)
+    # Again, adjust connection location and disable autovacuum.
     {
         open(my $pgconf, ">>", "$installdir/$oversion-upgrade/postgresql.conf")
           || die "opening $installdir/$oversion-upgrade/postgresql.conf: $!";
@@ -515,8 +517,12 @@ sub test_upgrade    ## no critic (Subrou
         $tmp_param = "unix_socket_directory"
           if $this_branch ne 'HEAD' && $this_branch lt 'REL9_3_STABLE';
         print $pgconf "\n# Configuration added by buildfarm client\n\n";
-        print $pgconf "listen_addresses = ''\n";
-        print $pgconf "$tmp_param = '$tmpdir'\n";
+        unless ($using_localhost)
+        {
+            print $pgconf "listen_addresses = ''\n";
+            print $pgconf "$tmp_param = '$tmpdir'\n";
+        }
+        print $pgconf "autovacuum = off\n";
         close($pgconf);
     }


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: Allow lwlocks to be disowned
Next
From: Jeff Davis
Date:
Subject: Re: pgsql: Trial fix for old cross-version upgrades.