Re: [PATCH] pg_upgrade: handle failed nonblocking connects on Windows

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Harrison Booth <harrisontbooth(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] pg_upgrade: handle failed nonblocking connects on Windows
Date: 2026-10-31 11:07:33
Message-ID: 35cbe0ed-d9c5-40ea-a856-c837288c0d2c@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16/10/2026 21:28, Harrison Booth wrote:
> I agree here. v2 (attached) passes a separate exception set through
> select_loop() and checks it on all platforms. The existing EINTR loop
> is unchanged.
>
> All seven Windows assertions pass on native x64 and ARM64. Linux
> passes eight existing upgrade scripts plus EINTR,
> exceptional-readiness & refused-connect controls.
>
> I also tested it alongside the --initdb v8 proposal on 89e06d while
> retaining the test registrations. It applies to 1d45c5d.

> @@ -396,13 +400,16 @@ wait_on_slots(UpgradeTaskSlot *slots, int numslots)
> if (slots[i].sock < 0)
> pg_fatal("invalid socket");
> FD_SET(slots[i].sock, slots[i].select_mode ? &input : &output);
> + /* Failed nonblocking connects are exceptional on Windows. */
> + if (!slots[i].select_mode)
> + FD_SET(slots[i].sock, &exceptions);
> maxFd = Max(maxFd, slots[i].sock);
> }

Any reason to not set the exception set when select_mode == true ?

>
> /*
> * If we found socket(s) to wait on, wait.
> */
> - if (select_loop(maxFd, &input, &output) == -1)
> + if (select_loop(maxFd, &input, &output, &exceptions) == -1)
> pg_fatal("%s() failed: %m", "select");
>
> /*

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-10-31 11:32:34 Re: Hash index: stop registering pin-only bucket pages in WAL (remove REGBUF_NO_CHANGE)
Previous Message Amit Kapila 2026-10-31 11:05:40 Re: Proposal: Conflict log history table for Logical Replication