Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wZnzV-001IGu-1S for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jun 2026 10:59:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wZnzS-005bk5-30 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jun 2026 10:59:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wZnzS-005bjx-1f for pgsql-hackers@lists.postgresql.org; Wed, 17 Jun 2026 10:59:26 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wZnzR-00000000nE4-19nc for pgsql-hackers@lists.postgresql.org; Wed, 17 Jun 2026 10:59:25 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5aa68d7d757so4905422e87.0 for ; Wed, 17 Jun 2026 03:59:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781693963; cv=none; d=google.com; s=arc-20240605; b=VCH5nI7p5Y6Ovo7+DzOEB8RAvak8mW6zNQRAirtNiQVzobxPsuU0AY4c9RKeoPVRcT IdkFKUFAefVDeMAJs3YJ4QwqBbQSaq13eZsH/XW/YMGWVgYLOjnAE5CCHrH3UvkHfuyy o6xFj5LVyKoc40JnzFnfh62k5QhAwywlwmf1FvkoX/WvM49NIkCDKZTBdErz4etQIYyC 1yKZtqhpBlB2xQF+/0nHoo634EsCJaVVPMhV8msY1aZ60qZNB3NA0KLzY10t7u4tDL5k b9e5EKtDK5pYlC6Zy5Tk3VUdM2rukMsV565G90wGZ6QKQ+xZhsJPWfmNCUhwwTHlqFa8 5xAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pcMrGbj7P+eHBgxKEf3tmkkpK8xsj1/tKMo08jSbET0=; fh=2p00RkO1F+4Pz5unMo4338w+4m8U0o7RvEqtBZ34cYk=; b=c2m4eiTZ/OBXoF9SbOygKO7Ugi3vUX37blzpIMRJV0c4eaJ17dRmCfRtHRNoqJXY5X rsYiLiO/3NtVLV3k4mPd4f4T0Da3RBEparOpEo0qRtNFWSm2U23uB+P6+YYmnGRlEv9r YmBFPQBBUT9CJJfQi0pdQR6W7Tp2uoR1TP+PchLhtTTjo/EPBD51n8CKOu0JdjDEK7K4 iTr4Yh9Bu5Be5uocV5K9E7q9MPq2u4ChEU87jJdCASOrnIu2pUPnj46do+KwIHM+6qCd RXI4EUV1vdQ3HcIWk3EXGL2jz5fPEAs8GpfCMkc0d1r8YxHv7UFXpZ4Xta/TFolRdmpu f1gQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781693963; x=1782298763; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pcMrGbj7P+eHBgxKEf3tmkkpK8xsj1/tKMo08jSbET0=; b=nhX+m+xqpwKML9RoyX4ObMHIqvTT47+T8xKtBEwgFxEGjTq+k37cfrvFQaVY7QFr8d rnTsxcN4QrQ50lb20c+dViIUM93gEV8bZ55GLfudR4xMCQAHXFWepzCsQNXeWVFjU8JP LJWc66Gi0jKMVeHYA7SbuEhykp8INpzUb9zqiaEEfik205f3jhgv2G/aq260TQx5/yTP dT/VwPqRStYvyZncgkmuejuApq6yju1waAdUNe+ZARPce6w4ywyk72iwndbxBXlnyTWp if1zTMezWCFodBpbO+gxpKQfWxG0amfQFkOTp5Mty62mJRhO3o95GhxTmPsZZfiRQw/W Gb9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781693963; x=1782298763; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=pcMrGbj7P+eHBgxKEf3tmkkpK8xsj1/tKMo08jSbET0=; b=L5XC4YLzSRaLnAFBgRPfWiRrWeO3P671Xq18VaLefQ/iFYaFOqwPsuWMqzyjnD09XW mxscW0XmQUORVXRmWWM6nJLb9px566TJ+Ee9VKRcDo0PM0RfKhM8Ua7SqhubyYpBcayc duIzbFyV8Y1HmQLBKYngPMyPAL1p272ZoeAKpaM3A2oNvRgbILkvAX47FQoGXzIdINn1 96UXaaEg1ZD74tnPeCIbHL6gLX7DwDRZEzeNbxabkytlSb4uC6nG9ACR+dggGL7afpS8 0sRe8/1DFUEWYSB79YpC0lkPWr+B35vNfu9RQ5bnQncBA7fxYItcLbtBisjgIWFVz0ef nIoQ== X-Forwarded-Encrypted: i=1; AFNElJ88Q+1bgq/hccWJ06PY0JFJjiH8pagUJlmA6/t3e2IQIiluuh8omrcceSO65qjXtuv84/PrSYitbKxMuiha@lists.postgresql.org X-Gm-Message-State: AOJu0YwQ37IctgVDb018oQ/n33bmYo5moBjhQQCrXJF9FI9dCARpAg8j Ry1MGXFFyO3/09xFCq+QtfQbbunDEAYmqew9vPIKoK6kV3vnXEJQXdNcnq/3VP/2tkRO6FOGK3x AbmkPcx9R46i2rKnjHqnG9Ye+jh5T9w== X-Gm-Gg: AfdE7clNTz8QtjKyJLGaDcmvc/2lLqGsqSW7WZHlt1+gh/vw6zfsPIArag9AOjAl528 NUmxsuYt5V3RMElKdka4hL0nwQKwKE9412jMyRscZppnzMtmESm9vw69i7Yz0ebVjoBhSlIZB/l tlAanfjdr0eBdhnYMWWc6jDrVwzlAWMtw100xz+JF9hYtn2NL28VZaHFJX8WkDGWEyLpL6nJ4Xv Qq4Zi6+F7uRdF3sqzz6liyWQhW5FOD2Pa7HpIcc4SFOQI1SdtfEf+6pkjM/VlLH/uIUQGn92e8w Mqom0Q11+Q2woPMB4xUZA0GMWIZy X-Received: by 2002:a05:6512:3c86:b0:5aa:6e60:1983 with SMTP id 2adb3069b0e04-5ad4700e7efmr934643e87.24.1781693963015; Wed, 17 Jun 2026 03:59:23 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nisha Moond Date: Wed, 17 Jun 2026 16:29:11 +0530 X-Gm-Features: AVVi8Ce_WoRpUpSPamqAGDUuSHqlTIVjdin38rFJ-_UbMnF_Its7np_wdmnWYlw Message-ID: Subject: Re: [PATCH] Preserve replication origin OIDs in pg_upgrade To: Ajin Cherian Cc: Shlok Kyal , shveta malik , Zsolt Parragi , vignesh C , "Hayato Kuroda (Fujitsu)" , PostgreSQL Hackers , shveta malik Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jun 17, 2026 at 2:49=E2=80=AFPM Ajin Cherian wr= ote: > > I have addressed the comments in v8 (attached). I've also now taken > out the check for PG17 on old cluster and now all clusters which have > replication origins are migrated. Hi Ajin, Thanks for the patches. I have started reviewing the patches. Please find a few initial comments below (from v7 review, still applicable to v8): 1) Patch-002: pg_dump.c + if (dopt->binary_upgrade && subinfo->subenabled && fout->remoteVersion >=3D 170000) { - if (subinfo->suboriginremotelsn) - { - /* - * Preserve the remote_lsn for the subscriber's replication I could not find any usage of subinfo[i].suboriginremotelsn anymore. It seems to be dead code now. Can we remove it? ~~~ 2) Patch-002 : binary_upgrade_create_replication_origin() - PG_RETURN_VOID(); + node_oid =3D PG_GETARG_OID(0); + + if (node_oid =3D=3D InvalidOid || node_oid > PG_UINT16_MAX) + ereport(ERROR, + errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("replication origin ID %u is out of range", node_oid)); + The above range check allows PG_UINT16_MAX, but that value is not part of the valid replication origin ID range. In origin.h: #define DoNotReplicateId PG_UINT16_MAX And we already ensure "ReplOriginId !=3D DoNotReplicateId" everywhere else. Would something like the below be more appropriate? if (node_oid =3D=3D InvalidReplOriginId || node_oid >=3D DoNotReplicateId= ) ereport(ERROR, ... ~~~ 3) I think we should add some additional details in logical-replication.sgml, especially under Prepare for Subscriber Upgrades. Some suggestions: 3a) Since all replication origins are now migrated, this: "...greater than or equal to the number of subscriptions present in the old cluster." could become: "...greater than or equal to the number of replication origins present in the old cluster." 3b) We should also mention: The new cluster must contain no replication origins. -- Thanks, Nisha