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 1wgd0d-006IgE-0A for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 06:40:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wgd0b-00FQVw-2r for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 06:40:49 +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 1wgd0b-00FQVo-1Y for pgsql-hackers@lists.postgresql.org; Mon, 06 Jul 2026 06:40:49 +0000 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wgd0Z-00000001lkH-31ci for pgsql-hackers@lists.postgresql.org; Mon, 06 Jul 2026 06:40:48 +0000 Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-7eb5a9f02e8so1156514a34.0 for ; Sun, 05 Jul 2026 23:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783320046; cv=none; d=google.com; s=arc-20260327; b=Zvm1r/Xpqs5osILm0U+gxY36qAfYkSz2Myu+He+91egmKYaetzwQxk/Kj2z+4SaLHJ G9jLzKo3Fnc0fVi9OvUsBdlB4zY496PaIR8x+fn+f/lFLeSyPMOXrkKIzeE4z4GcMnDV IsGo8xYHpYbJYHAwratmaT0p9ATsecot7lZ5rVaTk8xACESeRImMo8FO6mlMsaIJ2hxa KJ0EM5QTR2VOGXceOP9rytLFcE+Oqx4BzZhP8/IAAVkDOuu7Wh16ByEWBNxKo7slu/yp BLERCWlPPmT+65B0vXH1DGzPMn21Z6T/CvaAiotmJ0+KlWWFi5q/JgkEsarp00rf9Wc9 2ojw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=dSW7ACGKK7gT9wbMujsSekZFFcVQEyaX3kYuayCK/8I=; fh=1xqf3QifhvmdWImc/hl5Gwgfsg4BQex9h9j80vSDUG0=; b=B9AWmHt2mN5KSAwBPYlPkjb+jJXIizQ+DTsvNFnNOYiRuAl92XtkR+n96UByzAa9f8 pYz2zgMmj8BNcMOUEXYpBnqjJJM+PuDjSLv9Z+XoHXLEMKPy+3iT5KzuV9g8e4nXJYgS 9BiTNee4gonoWB/d6+i+LrCbbWdmWT1rtyQmWc1dudLjXFEgjHVgwj21HiO15LgEwPHI JCUoihHIeAAsZiiOEHITSr0mrb9VBxbQfCcLknzYCoZEB44gWQCYvVshiw2PfzPghjXa grXth95qixA/6xguvjR8b87DAIeSYox0BQ1IK1CaGMZi6rooIksu2NV+34iz1Z3552A7 q1Tg==; 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=1783320046; x=1783924846; darn=lists.postgresql.org; h=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=dSW7ACGKK7gT9wbMujsSekZFFcVQEyaX3kYuayCK/8I=; b=LVgQsGo3yTwVinnFvYCZ1mZnEZetae81BQf7/2A2sp3qaNLU4ZM92luJg8RSwz6MJr zqQujp4p8OyE3f0fogxqwmXtztddQCphCLow//CGKfHWJAgIy4fpim4gdc0VOpdIpd7N dnVk8vzfC4ywqzEAfC4vBGixzoH01MmD7XnQuCrY55F4BkhANdBbei2NC+7+srXm6z8K OyKYuy+nCNjos4R7gVurrVOpfi0x64LaVJFaXF/T/wp1nROY/htwApTG+g1B4xR5yj1Y lvVFeh90F3aiMJngVmr8yZyJ4j8GGgsvaVQ6F1jKd4JCEY+C89+pA5plDzbTMVVTu5uw LbJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783320046; x=1783924846; h=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=dSW7ACGKK7gT9wbMujsSekZFFcVQEyaX3kYuayCK/8I=; b=p4/sbyjDMOQkqYkv/91jOeXbOyal7sKwnZ5Gv7TXJs1wgvq8806uE5Z13xMs8eIdIY 6Dsa/1kpEKxF0csamWRBZ2ltVC0qLzudFvANh5zrCbMk6kN3B6uQEUy+CZg2AgdVl75p C9V8qxFD6Tv4ZJK3oU/Dfpm5wr2k2ORRLzkp9P6MqKDDeidf4Gw2Nh+qmkYhz+Vh0wEv Gzv7VN3OI7KOjHYtDDodE1A4YlwB/3mGCFRiOMHqaCyZXAJrbSha3gVWQTM0l1Q08qEl biNvVV2L5p1TVvZqK9m3l7JjXF3D0B7WZPz6Kv6ruO7hd1Ks5zyvguBynT9156bz49Jt ycAg== X-Forwarded-Encrypted: i=1; AFNElJ/gYB4DF1CEnCYCJi1PSOz+HXSKGrvK9VTS4tbz4mQbVR/AbtmjsjhVg7PC+m/nu8SwGX7S9Vzkn0xf25jd@lists.postgresql.org X-Gm-Message-State: AOJu0YxUQZI0oV/o2Ru3yaSecil/Lk9TkEz607tQB7BelWJHaFKbcPCv Lv4G+65D5KXlKCPHBkVk2iNn7GQRvgdCxL4EwAuZT13liPv5by/LCwJ0tdoneHh9uhQmBY8Sqmn P/BoqNePJS/hZb1gWN1I52HPbrowiabQ= X-Gm-Gg: AfdE7cmrWkNbglWUaW5eBO/lyMpx60pP0R+gXn7RZ355NheZUcnQelBtN6JtDMZ9Gtn 0JLlHdCaIQpsXB9j2Xnooetrtkc3/zCCpJepTZCwtG+gDFL1uWXhOxYRKklHCVqFp4ODgavBZ1/ VCwP3iIF3LiZ/vMHBh0BkSpnCgftynnFSLCP+QdP51XJM8b4WQvBHELlFQ0FRl+yiT8UTFhhD21 pUXRqknIWgfTYwDYcPUo3LhOOGhNu1zTWRmb2SxO012r6wUDK5dtvXA5RySCL4WFt/54QA3kwoD KF7PRJ4= X-Received: by 2002:a05:6830:2907:b0:7e9:e094:db97 with SMTP id 46e09a7af769-7eb7fd53ac6mr4593298a34.1.1783320045942; Sun, 05 Jul 2026 23:40:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shlok Kyal Date: Mon, 6 Jul 2026 12:10:34 +0530 X-Gm-Features: AVVi8CdnPJomQGU_c05KSPT_WfTbnQa22eOY7Faep9tnm8h4RaYu_CgDYJZGFH0 Message-ID: Subject: Re: [PATCH] Preserve replication origin OIDs in pg_upgrade To: Ajin Cherian Cc: Zsolt Parragi , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > All the above changes are updated in patch v10. > I noticed that we can create user defined replication origin even if the total count of replication origins exceeds the max_active_replication_origins Example: postgres=# show max_active_replication_origins; max_active_replication_origins -------------------------------- 1 postgres=# select * from pg_replication_origin; roident | roname ---------+---------- 1 | pg_16387 postgres=# SELECT pg_replication_origin_create('origin1'); pg_replication_origin_create ------------------------------ 2 postgres=# select * from pg_replication_origin; roident | roname ---------+---------- 1 | pg_16387 2 | origin1 postgres=# select * from pg_replication_origin_status; local_id | external_id | remote_lsn | local_lsn ----------+-------------+------------+------------ 1 | pg_16387 | 0/00000000 | 0/00000000 The documentation for max_active_replication_origins says: ``` Specifies how many replication origins (see ) can be tracked simultaneously, effectively limiting how many logical replication subscriptions can be created on the server. Setting it to a lower value than the current number of tracked replication origins (reflected in pg_replication_origin_status) will prevent the server from starting. It defaults to 10. This parameter can only be set at server start. ``` Since the user-created replication origin above is not actively tracked in pg_replication_origin_status, no error is reported. But with this patch, during pg_upgrade we are checking the 'max_active_replication_origins' against 'old_cluster.nrepl_origins' + if (old_cluster.nrepl_origins > max_active_replication_origins) pg_fatal("\"max_active_replication_origins\" (%d) must be greater than or equal to the number of " - "subscriptions (%d) in the old cluster", - max_active_replication_origins, old_cluster.nsubs); + "replication origins (%d) in the old cluster", + max_active_replication_origins, old_cluster.nrepl_origins); Since old_cluster.nrepl_origins counts all replication origins, including user-created ones that may not be tracked, should this check instead compare max_active_replication_origins with 'the number of rows in pg_replication_origin_status in old cluster' (i.e., the number of tracked replication origins)? Thanks Shlok Kyal