Re: [PATCH] Preserve replication origin OIDs in pg_upgrade

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: Ajin Cherian <itsajin(at)gmail(dot)com>
Cc: Rui Zhao <zhaorui126(at)gmail(dot)com>, 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>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: [PATCH] Preserve replication origin OIDs in pg_upgrade
Date: 2026-08-19 09:52:46
Message-ID: CAJpy0uBrVLU1mgzWGKZkWjXHhxDW+OgZd2uCQskfPKkGYvTUjA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 19, 2026 at 11:13 AM Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
>
>
> I have incorporated your comments and your changes in a new patch v16.
>

Please find a few minor comments:

1)
+ if (!PQgetisnull(res, i, i_remotelsn))
+ {
+ appendPQExpBufferStr(buf, ", ");
+ appendStringLiteralConn(buf, PQgetvalue(res, i, i_remotelsn), conn);
+ appendPQExpBufferStr(buf, "::pg_catalog.pg_lsn");
+ }
+ else
+ appendPQExpBufferStr(buf, ", NULL");

It is recommended to typecast even NULL to datatype to remove any
ambiguity in function signature matching (for future cases). IIUC,
Null is treated as unknown datatype.

Suggestion:
appendPQExpBufferStr(buf, ", NULL::pg_catalog.pg_lsn");

2)
+ * Create a replication origin with a specific ID and name, optionally
+ * restoring its remote_lsn.
+ *
+ * The created replication origin is advanced if need_advance is true. It can
+ * be set only in binary upgrade mode.

'optionally restoring its remote_lsn' and 'origin is advanced' seems
like 2 different steps while both are same and are dependent upon
'need_advance'. Suggestion:

Create a replication origin with a specific ID and name, optionally
restoring its remote_lsn when need_advance is true. need_advance can
be set only in binary upgrade mode.

3)
- Commit timestamps and origin data are not preserved during the upgrade.
+ Commit timestamps are not preserved during the upgrade.

We can make it sligtly more clear if you agree. Suggestion:

Commit timestamps (which include the origin of the commit) are not
preserved during the upgrade.

4)

+ old subscriber was up to. Migration of the subscription's replication
+ origin is supported for all cluster versions.

Shall we say:
all supported cluster versions

5)

+ configured to a value greater than or equal to the number of tracked
+ replication origins present in the old cluster (reflected in
+ <link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link>).
+ The new cluster must contain no replication origins.

To give better continuity in this paragraph, the last sentence can be
changed to:

Furthermore, the new cluster must not contain any pre-existing
replication origins."

thanks
Shveta

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2026-08-19 10:08:56 test_aio: Fix broken error recovery assertions in 001_aio
Previous Message Heikki Linnakangas 2026-08-19 09:52:14 Implicit shell type creation, little fixes