Re: pg_upgrade and logical replication
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, vignesh C <vignesh21@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, Justin Pryzby <pryzby@telsasoft.com>, Masahiko Sawada <sawada.mshk@gmail.com>, Peter Smith <smithpb2250@gmail.com>, Julien Rouhaud <rjuju123@gmail.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2024-07-22T02:05:16Z
Lists: pgsql-hackers
On Sat, Jul 20, 2024 at 09:03:07PM -0500, Nathan Bossart wrote: >> This is an extremely expensive way to perform that check, and so I'm >> wondering why we don't just do >> >> SELECT count(*) FROM pg_catalog.pg_subscription; >> >> once in count_old_cluster_subscriptions(). > > Like so... Ah, good catch. That sounds like a good thing to do because we don't care about the number of subscriptions for each database in the current code. This is something that qualifies as an open item, IMO, as this code is new to PG17. A comment in get_db_rel_and_slot_infos() becomes incorrect where get_old_cluster_logical_slot_infos() is called; it is still referring to the subscription count. Actually, on the same grounds, couldn't we do the logical slot info retrieval in get_old_cluster_logical_slot_infos() in a single pass as well? pg_replication_slots reports some information about all the slots, and the current code has a qual on current_database(). It looks to me that this could be replaced by a single query, ordering the slots by database names, assigning the slot infos in each database's DbInfo at the end. That would be much more efficient if dealing with a lot of databases. -- Michael
Commits
-
pg_upgrade: Retrieve subscription count more efficiently.
- 73de50e13e39 17.0 landed
- 364509a2e7f9 18.0 landed
-
Fix random failure in 004_subscription.
- 677a45c4ae16 17.0 landed
-
Fix 004_subscription.pl to allow its usage in --link mode.
- f17529b71097 17.0 landed
-
Allow upgrades to preserve the full subscription's state.
- 9a17be1e244a 17.0 landed
-
Prevent startup of logical replication launcher during pg_upgrade
- 7021d3b17664 17.0 landed