Re: [PATCH] Preserve replication origin OIDs in pg_upgrade

From: Ajin Cherian <itsajin(at)gmail(dot)com>
To: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Cc: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Preserve replication origin OIDs in pg_upgrade
Date: 2026-07-21 10:16:13
Message-ID: CAFPTHDbzFX9caHNEzUHd4aHoQq==L40nUyR7YxPGV3m3RXnBUQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 17, 2026 at 3:17 PM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>
> On Thu, Jul 16, 2026 at 11:36 AM Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
> >
> > On Fri, Jul 10, 2026 at 6:28 PM Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com> wrote:
> > >
> > >
> > > Thanks,
> > > Shlok Kyal
> >
> > Thanks for all the comments. Here's an updated patch addressing these comments.
> >
>
> Thanks Ajin. A few trivial comments:

I've addressed all the above comments.

There was also a CFbot failure on linux machine as below:

# Failed test 'run of pg_upgrade where the new cluster has
insufficient max_active_replication_origins status (got 0 vs expected
1)'
[02:43:22] t/001_basic.pl ................... ok 180 ms ( 0.00
usr 0.00 sys + 0.11 cusr 0.04 csys = 0.15 CPU)
# at t/004_subscription.pl line 60.

I don't see the same error on my machine, but I think the problem is
because the node is stopped too soon after the subscription is
created. So I've added logic to wait until the replication origin
becomes active.

+# Wait until the apply worker sets up the replication origin, making it
+# active. Otherwise, stopping the old cluster too early could leave the
+# origin inactive, causing the check below to see no active replication
+# origins and fail.
+$old_sub->poll_query_until('postgres',
+ "SELECT count(*) > 0 FROM pg_replication_origin_status")
+ or die "Timed out while waiting for the replication origin to become active";
+
$old_sub->stop;

regards,
Ajin Cherian
Fujitsu Australia

Attachment Content-Type Size
v13-0001-Preserve-subscription-OIDs-during-pg_upgrade.patch application/octet-stream 9.4 KB
v13-0002-Preserve-replication-origin-OIDs-during-pg_upgra.patch application/octet-stream 36.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Japin Li 2026-07-21 10:16:27 Fix optind handling inconsistency in getopt_long() for missing argument
Previous Message Paul Kim 2026-07-21 10:02:37 [PATCH v1] Add vacuum_delay_point() to GiST empty-page deletion pass