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 1w0y25-002N5o-0u for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Mar 2026 08:38:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0y23-002Xv4-2Z for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Mar 2026 08:38:08 +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 1w0y23-002Xuw-1P for pgsql-hackers@lists.postgresql.org; Fri, 13 Mar 2026 08:38:08 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0y21-00000002Qst-1IdH for pgsql-hackers@lists.postgresql.org; Fri, 13 Mar 2026 08:38:07 +0000 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-82989744ee0so1891930b3a.2 for ; Fri, 13 Mar 2026 01:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773391083; x=1773995883; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zg8us4yHSk8qf5tgrh1fPAO8bkl4TBjUmlWFClIeLy0=; b=D7UPSXFb5fNUBs7gNFoRlNhiwQKQyv1D5vln395eQvLmkJAxMdG9QNjPGvOk8diDRP 5RixOaZCswf2JO0KvuVDehdkNlljPRuUmyx5/hwCQnqr95b282hy6hwn5U36J23DzDdu ck5mNZwCAYqMTUI/5veLo9xadsO/GsMu3Vl0oHsb7qWz5wGTeSIgxltmQgNMRfQgbbLo tHfpvfKtc4OnX+vP0j//R96d+HOQPhxeFlvi7fzGAWpBMSUu1Jl7mQ/qpPY9fMIv4ahi wLvQQxNQOvJg0FLjQFDwqhQkVp2o413AQ7XTAfWmf7q/AekFGhpZuAaP/dnwf8lZE065 lXhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773391083; x=1773995883; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=zg8us4yHSk8qf5tgrh1fPAO8bkl4TBjUmlWFClIeLy0=; b=frZtaZ3aKb43PKVjoCHCbExH2m3z1s+L5qtxbT/uSI8HdMFYTgEyNHOskm7xJKqhia 9GqEw9/CfhzON1lfUDhkENMsDYvCY7UWsOrewFDRw4uw+Uyg0N8QnB5fBNpQ3GxBsyIR /0uIspgbIZ+usUpYLNKCYNuXQdofQPidektkogjFcGVMZ0g1x6KTO2YbVhRf6lqWZzT6 9W573dYuFAJEnIDgS9mQfxAuWsaQFGYkDnihU2BzRO5F4auimkmnTKvtBJAiqMCoXnm1 LTaqehK0aDVsH2zBcVYYTrTrYFVKMSIdeqTMQyzXGd28I6AkoTh9S6a2rnzRrHtteVVs 8HWQ== X-Forwarded-Encrypted: i=1; AJvYcCVtu/VuR5gdmxB1HcIZ7ZXtsPaQdabiuCSeljCvfYHuXmP7aVP2Hwc4CL2bUKfmhdfuV2OGWMdGmejNLb65@lists.postgresql.org X-Gm-Message-State: AOJu0YzVFJGWUSdORcM5fl6N+2rekMLka7Vr1dprCeah9wrrtx+UutZe Zhx9LhG+XQxE/kPiJCqB56sG/e1yg0k1mF+MKHz3sovVVlJt+GBvZ1jI X-Gm-Gg: ATEYQzxsGfKmXNmmc1Vgjie+cvYIq6Hz7X220vKRxjtFOPUms1ZkeqxNYQ3oLOUc07w 0wftBrZ33F6gwIZ53JIPnp2SB8TslXxWEXB+XVeGoO2119hR5KKDYMUhfEOPJPuXbvn2Ce6eX3g E6KMobY8yiTy9mC9MJZCjBWlHM6bOQ7QEMWSSoftBXgm6MTKWuGjRn5bXp2qsLOhf7GmssH4j+x yB72Hgj3H5eeNk8rbgyWmfRIKIWLkxpkvJunebYjjf6HiYH3nP7XJJhyV1lgeLN5k5AhLkDLOWf q7wkRL3jD/MHIpR1CueGDlm/kYFVsn43clJkTWiMnAPOMyVJndIrcFYk6uXIE5nUZAe0QvNWsyK L56BYRwlG8G1ej/eHofGKRvOf0prY2AbpF4R4MLheNViaLcmX2gbxZUHMpIDaXNTzfmeOFPxjrp SWDzd/TExoMrizblnVTu88oM2vbigkzMIFlZuuL0/4yA== X-Received: by 2002:a05:6a00:1a8b:b0:81f:9bc0:e45e with SMTP id d2e1a72fcca58-82a1996ae94mr2178185b3a.65.1773391076269; Fri, 13 Mar 2026 01:37:56 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82a073b265bsm5530732b3a.65.2026.03.13.01.37.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2026 01:37:55 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: [PATCH] Support automatic sequence replication From: Chao Li In-Reply-To: Date: Fri, 13 Mar 2026 16:37:15 +0800 Cc: shveta malik , Amit Kapila , Ajin Cherian , "Hayato Kuroda (Fujitsu)" , Ashutosh Sharma , PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: References: To: "Zhijie Hou (Fujitsu)" X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Mar 13, 2026, at 15:13, Zhijie Hou (Fujitsu) = wrote: >=20 > On Monday, March 9, 2026 11:13 AM shveta malik = wrote: >>=20 >> No major concerns on 001, just a few trivial things. Do these only if = you feel >> okay about these. >>=20 >=20 > Thanks for the reviews. I've updated the patch set addressing all = comments. >=20 > In 0001, aside from addressing comments in [1][2][3][4], I've changed = the > logic to delay updating the page LSN for each sequence in > pg_subscription_rel. Frequent catalog updates would generate many > invalidations, degrading the performance of the apply worker which > relies on cached data from pg_subscription_rel. >=20 > 0002 adds caching of sequence information for the current subscription = in the > sequence sync worker. The cache is invalidated immediately when > pg_subscription_rel is modified. Concurrent changes to sequence names = or > namespaces are detected before synchronization, as the worker verifies = the > sequence data at sync time. >=20 > 0003 (formerly 0002) modifies REFRESH SEQUENCES to synchronize = sequence values > directly without launching a worker. >=20 > [1] = https://www.postgresql.org/message-id/02EDB3D2-4E5A-4EDE-BADF-3DF62D707831= %40gmail.com > [2] = https://www.postgresql.org/message-id/OS9PR01MB12149E4614DA95963670772EEF5= 79A%40OS9PR01MB12149.jpnprd01.prod.outlook.com > [3] = https://www.postgresql.org/message-id/CAJpy0uAmEkjsBS6RxPv9iDcK2kfJ5%3Dbq4= Mq1zMCQtaYFoDfbbQ%40mail.gmail.com > [4] = https://www.postgresql.org/message-id/CAJpy0uC0T_tp62zxJN_2d_A%3DYpvf14ebj= GFepckeJugW5OHOyA%40mail.gmail.com >=20 > Best Regards, > Hou zj > = I reviewed v12 again. 0001 looks good. A few comments on 0002 and 0003. 1 - 0002 ``` + /* + * Setup callback for syscache so that we know when something = changes in + * the subscription relation state. + */ + CacheRegisterSyscacheCallback(SUBSCRIPTIONRELMAP, + = invalidate_syncing_sequence_infos, + = (Datum) 0); ``` I wonder if SUBSCRIPTIONRELMAP should be SUBSCRIPTIONREL? 2 - 0003 ``` + /* + * Use the current memory context for synchronization. = Since this should + * be short-lived command context that will be cleaned = up automatically, + * we can simply assign it as the synchronization = context. + */ + SequenceSyncContext =3D CurrentMemoryContext; ``` I think it=E2=80=99s still better to create a memory context from = CurrentMemoryContext for SequenceSyncContext, and destroy it after = copy_sequence. Today, this is only on the SQL command path, CurrentMemoryContext is = supposed to be short-lived. But AlterSubSyncSequences() might be called = somewhere else in future, then we could not predict what would be = CurrentMemoryContext. 3 - 0003 ``` "output the wanring for the missing sequence regress_s4=E2=80=9D); ``` Typo: wanring -> warning Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/