Re: pg_upgrade: Test --check with a running source server

From: Ewan Young <kdbase(dot)hack(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: pg_upgrade: Test --check with a running source server
Date: 2026-08-31 10:54:52
Message-ID: CAON2xHMRAb9M_dKF6WuwVHQLLmGYXkKp=KQpCy7URKD3Av2OhA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 31, 2026 at 4:19 PM Bertrand Drouvot
<bertranddrouvot(dot)pg(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-08-31 10:55:01 Re: Offline data checksum changes can cause incorrect checksum state on standbys
Previous Message Pavlo Golub 2026-08-31 10:47:13 Re[2]: [PATCH v4] Add pg_current_vxact_id() function