Re: optimizing pg_upgrade's once-in-each-database steps

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Ilya Gladyshev <ilya(dot)v(dot)gladyshev(at)gmail(dot)com>
Cc: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: optimizing pg_upgrade's once-in-each-database steps
Date: 2024-09-04 01:41:49
Message-ID: Zte63Vz4E2P-VOwE@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 04, 2024 at 12:28:23AM +0100, Ilya Gladyshev wrote:
> The fix looks right to me, but I got confused by the skip_wait and this
> `if`:
>
> +            if (PQstatus(slot->conn) != CONNECTION_OK)
> +                return;
>
> This branch checks connection status that hasn't been refreshed after the
> select. When we go back to wait_slots after this, PQconnectPoll will refresh
> the connection status and run select with skip_wait=true, I believe, we
> could simplify this by moving the PQconnectPoll back to the process_slots,
> so that we can process connection right after polling, if it's ready.

Ah, yes, that's a nice way to simplify things. I ended up just making it
process_slot()'s responsibility to set the correct select_mode, at which
point the logic in the switch statement in wait_on_slots() is sparse enough
that it seems better to convert it to a couple of short "if" statements.

--
nathan

Attachment Content-Type Size
v13-0001-Introduce-framework-for-parallelizing-various-pg.patch text/plain 17.5 KB
v13-0002-Use-pg_upgrade-s-new-parallel-framework-for-subs.patch text/plain 9.2 KB
v13-0003-Use-pg_upgrade-s-new-parallel-framework-to-get-r.patch text/plain 15.7 KB
v13-0004-Use-pg_upgrade-s-new-parallel-framework-to-get-l.patch text/plain 3.8 KB
v13-0005-Use-pg_upgrade-s-new-parallel-framework-for-exte.patch text/plain 4.2 KB
v13-0006-Use-pg_upgrade-s-new-parallel-framework-for-data.patch text/plain 13.5 KB
v13-0007-Use-pg_upgrade-s-new-parallel-framework-for-isn-.patch text/plain 4.7 KB
v13-0008-Use-pg_upgrade-s-new-parallel-framework-for-post.patch text/plain 6.3 KB
v13-0009-Use-pg_upgrade-s-new-parallel-framework-for-poly.patch text/plain 7.5 KB
v13-0010-Use-pg_upgrade-s-new-parallel-framework-for-WITH.patch text/plain 4.4 KB
v13-0011-Use-pg_upgrade-s-parallel-framework-for-encoding.patch text/plain 5.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2024-09-04 03:02:14 Re: Improving the latch handling between logical replication launcher and worker processes.
Previous Message Michael Paquier 2024-09-04 01:25:17 Re: Typos in the code and README