Re: pg_upgrade and logical replication
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: vignesh C <vignesh21@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>,
Julien Rouhaud <rjuju123@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-11-02T08:45:16Z
Lists: pgsql-hackers
On Wed, Nov 1, 2023 at 8:33 AM Michael Paquier <michael@paquier.xyz> wrote: > > On Fri, Oct 27, 2023 at 05:05:39PM +0530, Amit Kapila wrote: > > I was analyzing this part and it seems it could be tricky to upgrade > > in FINISHEDCOPY state. Because the system would expect that subscriber > > would know the old slotname from oldcluster which it can drop at > > SYNCDONE state. Now, as sync_slot_name is generated based on subid, > > relid which could be different in the new cluster, the generated > > slotname would be different after the upgrade. OTOH, if the relstate > > is INIT, then I think the sync could be performed even after the > > upgrade. > > TBH, I am really wondering if there is any need to go down to being > able to handle anything else than READY for the relation states in > pg_subscription_rel. One reason is that it makes it much easier to > think about how to handle these in parallel of a node with > publications that also need to go through an upgrade, because as READY > relations they don't require any tracking. IMO, this makes it simpler > to think about cases where a node holds both subscriptions and > publications. > But that poses needless restrictions for the users. For example, there appears no harm in upgrading even when the relation is in SUBREL_STATE_INIT state. Users should be able to continue replication after the upgrade. > FWIW, my take is that it feels natural to do the upgrades of > subscriptions first, creating a similarity with the case of minor > updates with physical replication setups. > > > Shouldn't we at least ensure that replication origins do exist in the > > old cluster corresponding to each of the subscriptions? Otherwise, > > later the query to get remote_lsn for origin in getSubscriptions() > > would fail. > > You mean in the shape of a pre-upgrade check making sure that > pg_replication_origin_status has entries for all the subscriptions we > expect to see during the upgrade? > Yes. -- With Regards, Amit Kapila.
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