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 1whP7F-000Cb1-1d for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jul 2026 10:02:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whP7E-006X4o-04 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jul 2026 10:02:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1whP7D-006X4g-2A for pgsql-hackers@lists.postgresql.org; Wed, 08 Jul 2026 10:02:52 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1whP7B-00000000DYj-2vYf for pgsql-hackers@lists.postgresql.org; Wed, 08 Jul 2026 10:02:52 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-2cac59f8b64so5785155ad.0 for ; Wed, 08 Jul 2026 03:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783504968; cv=none; d=google.com; s=arc-20260327; b=X15FFjW6ANuInlg53eiLrws/5v58mcXKfaKmzSD7nJOO7TlIbThyDV+86z9+Wljj3j WmmrYIqtU3smPseMSb/ISe/LAQWYl7eVKM6iuZjE9OmnUL9bPPnXgPe3gW49oQxsC9fr XE9eMsGzTQPJQLrEqbY3Qw4MU60hO6SjY07jqg61ruv5fsFpx+TEnadaz528SaT1gyOq 1TUJnWIwNaKQQ67Mbql37yxgzmXNk0hvyF0bSzCEF8536V58rpxzBOzjlZpXvCKGSo0h GpAMhK38SbsM/fPO1s4p03Q9vpLasKHzBEEJe/yik7iMeaknurmgLxCNYQ8IWnn60FNZ VmOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4k/FqI2deXj54a6oB3bxhVFFsH2anOZAxTN7mDxmWto=; fh=NWmLeqzK3AajDlywCpgUcdT2XgH60l3cU4w1pRC7/fY=; b=aKi5s0ydMusU89HsLyHvkQuUBt5VIfhGcA0tYnvnWOZjDEP9YpdF4caJx3mo12WFW7 u0V7699kB1QM/G+uYFyX08Z9REOstkAEqC96uivDXtSj2dvARL75Zlz0evSx1chBY1zR U14MjTVff479Hu7MDRYBO/sWhXOiNe/FWZn+BZyqHpGxrMgLwXmeU2eUfZZQPecKaJxD Sfsm8YbPPoMFG05sWlug3bcisUiunSpZIl03n3iRScPSmCxUewy5uyQpIPTxP7X+9idu tE13QrQdAurlYV0baTdx8IlIky0DX9H7Rxihi947sEhHhr8wEzUYFthIDaOQ5zvu87Ac LsZQ==; 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=1783504968; x=1784109768; darn=lists.postgresql.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=4k/FqI2deXj54a6oB3bxhVFFsH2anOZAxTN7mDxmWto=; b=e18JDQQCpbNoGfpNFkU3t10bXtY5HpLkKVm/CvzpJAgvo6xdIIzIYrpkDPtfSbNKXn IJjYgLCtgpJoSMl+Vf1CLNL5Oj3em9qJhODMHGRh8BC0tWnUdbeSKkYFlOicKyOZMz/a 8Em4d/o+C0Q4g8TggRccGox1DDYFGMpvsvQQHePBIErXzb/hKSSZOUrU0k2udn+VetLW VJy4dCKMwZwFCGukXTn89wavoEVfEWA3VCM1KxyyB4OtEHMnFBam88QfZbN6HBgMg0zz Gr9YOF/WYZG++rpR2qsWMpQx9WLRmo0BQspu5THYkqkaffuTvyHejTW59AeDUChzQEjb x3Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783504968; x=1784109768; h=content-transfer-encoding:content-type: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 :content-type; bh=4k/FqI2deXj54a6oB3bxhVFFsH2anOZAxTN7mDxmWto=; b=syEYZsUbRnwJgORrMdSxWJRbQPejc//KOjIX5cJoZ9eCyCK7KvouERilzjEkfaymSx rk4hHrBWC+4HuFrksxX5w0p6nISE6A+ccA7irXoDS/9bpuX/hgrC5MVXK/9ntrNyuEwk iHumAo2osB5IBBTqFEf/t/Snegf+VzCfRqLzNz0tg69yZucDrjVVVOaByRhn1VheGemK CyONeQBypl8eVQmSwAZLmeNak5CeuWgqBrn7ChxolbLkCFaZWHA5cRDJkFVUDbx/LtDt 6r//SCIGsgZ65JrYKPezd/HUtBR4TklDUnyPLDOnybBRpYlMllFZf045gOIRzAy6550z SRwQ== X-Forwarded-Encrypted: i=1; AHgh+RqL7R+fnPz+8BfX1gtGQt3M1Z1YO1bPIjj1igI1csgVDE5qUJSQ3Z+9qI7idSYn0w8mCh3CGQaTGaBXu9+X@lists.postgresql.org X-Gm-Message-State: AOJu0YwQwnPVIXJurnWnOkJgkfLtsA8RZRMHouqhgfVB9Rlp/kAk5oTd PhY9nDTpsgPZoqsB98425K5jgzv81hIs80H7ikQfPVuUeRtouD8La0SiA+1QlR9+IDmfg0RUS6i jjcQY0ojGWB7ufltFh/XvqmceyXorgK0= X-Gm-Gg: AfdE7cmYFQTxMPdrOkzQh+ENfCy7vq0Mc6frXWpMl50sI5trS30a2XtAJ931MbBDkix TCSwXs6FQ7TJi5DOuKWN9b+KOFcNDhzyKWtqCabPnslmoDxSSuBtuRJ07NvK9a9uYF38D2+g9ax E0+zocmjr0DoPUkqCPB/XdYojhU3L6FPZPujEjj4SGyYwRT6u2Lh9yQzxFeRI/6rC2KZodVDHt5 AKKlBnqsHlmBlHTEvSQjNcLS1UAkeXhvUCc1tPuTaE8ocWSm4wSXczL5rHS/CGkYryuHFBi8P9m +BIzZUJQ4wOvst2je+Ptd+mScNIOXnMpbjLTo2pNCurHVHnGCYPjaeE/hyShHpKSaAY39XcxFwQ = X-Received: by 2002:a17:902:ea06:b0:2c9:d277:2cdd with SMTP id d9443c01a7336-2ccea2f910fmr18839085ad.13.1783504967499; Wed, 08 Jul 2026 03:02:47 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Wed, 8 Jul 2026 15:32:35 +0530 X-Gm-Features: AVVi8CcHBRUhkAVrfNuhZKjWrtBdEVG_e2z-l6rT4xGcUKuh13mnBd5JJpx5kns Message-ID: Subject: Re: [PATCH] Preserve replication origin OIDs in pg_upgrade To: Ajin Cherian Cc: shveta malik , Shlok Kyal , Dilip Kumar , Zsolt Parragi , vignesh C , "Hayato Kuroda (Fujitsu)" , PostgreSQL Hackers 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 Tue, Jun 16, 2026 at 2:50=E2=80=AFPM Ajin Cherian wr= ote: > > On Mon, Jun 15, 2026 at 9:31=E2=80=AFPM Amit Kapila wrote: > >> >> Separately, I don't think we actually need to preserve the >> subscription OID to meet the goal here. pg_commit_ts stores the >> numeric roident, not the origin name or the sub OID, and conflict >> detection compares roidents. So the invariant we must keep is "each >> subscription owns the same roident after upgrade", which doesn't >> depend on the name being stable. >> >> > > Replication origins are global objects and are therefore dumped by pg_dum= pall, while subscriptions are database-specific and are dumped by pg_dump. = In pg_upgrade, pg_dumpall runs before pg_dump. > > The complication if subscription OID is not preserved is that subscriptio= n-associated origins derive their name from the subscription's OID. If the = subscription OID is not preserved across upgrades, the origin name on the n= ew cluster will differ from the old one, making it impossible to restore th= e origin independently. For these origins, creation must happen after Creat= eSubscription has established the new OID and not upfront in pg_dumpall. > > Non-subscription origins have no such dependency and continue to be creat= ed separately as before. The subscription code also cannot be left untouche= d: even once the subscription is created, rather than origin being created = inside CreateSubscription, its associated origin must still be explicitly c= reated via binary_upgrade_create_replication_origin to ensure the roident m= atches the original node, which means CreateSubscription needs to be modifi= ed anyways. So, there is an advantage of reducing code if subscription OID = is preserved and all origins keep the same name as the old node. > I think here the key is not reducing the code foot print in CreateSubscription rather the non-subscription origins anyway needs to be created separately by pg_dumpall as they don't have any binding with subscription. So, if we don't preserve sub OIDs, we will never be able to match the names of origins created with pg_dumpall and then later used by subscriptions. I feel this reasoning should be captured in the commit message. --=20 With Regards, Amit Kapila.