[PATCH] pg_upgrade: handle failed nonblocking connects on Windows

From: Harrison Booth <harrisontbooth(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] pg_upgrade: handle failed nonblocking connects on Windows
Date: 2026-10-13 20:58:52
Message-ID: CAAH-eSVf=Nvwb6P_HepLiHdKPuNnZANLYgq7CHLsEj54Tau7sg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pg_upgrade can stall when localhost first reaches a refused IPv6
endpoint on Windows. Its aggregate select loop omits the exception
set, so PQconnectPoll does not process the failure and try IPv4. Libpq
already handles this in its single-socket helper.

The patch handles exceptional readiness in pg_upgrade's existing state
machine. Its Windows TAP test checks both successful-first IPv4 and
refused-first localhost fallback, skipping when resolver/refusal
preconditions are unavailable.

All seven assertions pass on MSVC ARM64, MSVC x64 and MinGW x64. The
x64 runs use emulation on the ARM64 host. Earlier copied-upgrade tests
from released 18.0 x64 and official 19rc1 ARM64 also preserve the
seeded data.

The combined patch includes the tested production fix and test
controls. Exact revisions and coverage are recorded with the evidence.

Best,

Harrison

Attachment Content-Type Size
U-combined-review-candidate-v1.patch text/x-diff 5.8 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2026-10-13 21:39:21 Re: pgstat: allow a stats kind to use its own dedicated dsa/dshash
Previous Message Melanie Plageman 2026-10-13 19:58:18 Re: Why clearing the VM doesn't require registering vm buffer in wal record