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 1vsta7-0078GJ-0F for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Feb 2026 02:15:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vsta5-001Nyk-2L for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Feb 2026 02:15:53 +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 1vsta5-001Nyb-11 for pgsql-hackers@lists.postgresql.org; Thu, 19 Feb 2026 02:15:53 +0000 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vsta2-0000000044M-1hRd for pgsql-hackers@lists.postgresql.org; Thu, 19 Feb 2026 02:15:52 +0000 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-385cfc572f1so3856381fa.3 for ; Wed, 18 Feb 2026 18:15:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771467349; cv=none; d=google.com; s=arc-20240605; b=UABZdwXmZGb+ew0JC6lWBZV3d7wjrY+mvDRO0OvWORo03dpJJbBAG5AAIygrZCTFeO PPWHXOtVtLHGp12UN08DiGsXXtAZuad5xZpBcqStWjGviJm6Ofgt/UNHR8cuX2LmcgAR 25ko/pg11YWCHB5oBsiMQAr5KkBPOchS3HuGes0VVdKzOIRbmSp09W5uK9rwqH4H1Ff9 YifY+TZEylUN3B2YsW7el6qKlfhcpvo3Fld1DBV59xM6+vnDgvOJ+lajnIQSsBRN946W IHBPLg3sGmMnJ2vq7iH7bZFHKChSqLz5eJjt+fOhnOqfbawuFMZzFLOUXDm3piJW5J5q DLBw== 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=qF0VsDtaZ0cPdyBoTYe8/xutIkwSDPy+C/zHmxOs8A4=; fh=GUAxG/j5aMz2rm6ag2wv/AaLRyiAFDW+r20fOH5ibdU=; b=Gc39hoojNDts44/s1uVYyiqs7dSTrBCndNDhvPTCAxuBKGfsxNGCE7HwiDRnrHhCwx xiMBeygmIfiu54MJ8/rltwlY/FUDmOgFPQMaCqnVNcxckZHQkmVe+HKyIh8HeNFcmbq9 HUtnI1l4YRqJfVgCYpGaQc6g8xocIkO/W1V0jKH/ucAPiMFFsRy83tKfM83HUaTw9HpM HiA8ALErfFG4Z3+ux2/T5p/pkhYuT6FXb1RQMlnuguXYI33PlYE0OVFjN03MCDn1LeLe f4poO4h4+pJyFbz/JhLgkNkq8jjm+0SDvgiCtxbIcFfZjs1o1ye8/Lyrw20om+GFnztv w4Tg==; 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=20230601; t=1771467349; x=1772072149; 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=qF0VsDtaZ0cPdyBoTYe8/xutIkwSDPy+C/zHmxOs8A4=; b=jxUjcZiZoR2jelIg6JLm19ZUPoImXDUuEl01giZ15EytoWj+/BGx7iJu0A69kO+an7 zpS8ePj2quUlYJ9RT68+x4LE0j+REUHb9/4cJBQbYVqeNmh35yeSmBxpjt1t4ISNkGsH vImMED40BcbWiXicxITByQJMzsOe7ZmHqAPAhEwdRxNaxlixaVVxF1JHlmAHod3LOwfR xGjGsnknTYTVuM5j9CwN6z2QuS1RqZkKO/veFmclQcfOaCM2yckC8FUC9YcAHRwcioCd 9Q6W/X6CatQ8oTpEufz1Rm8Y8VHZQ0sfQ1HU+ErMn7Jyh4kputAIFjLYbwNT9pS5DW6U KhJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771467349; x=1772072149; 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=qF0VsDtaZ0cPdyBoTYe8/xutIkwSDPy+C/zHmxOs8A4=; b=ICH5FNZlZDcFcQcHDtA2BYH6WUvXummB4m/q9DurCp8GS1GnZUR0oaVNFcXTEfeFy1 6MVEUMr5KWp/Gh6bFjfx8s5jrvMrCJTmbUD0O3z0CpiUBfaui7u+T7KMwJtWsSfE2mRS Gr7f9q65xz6pbb8i6PtjcXOtohr66Z5XUBI8fkPMbcXMwegm6oJEqFi9Cdg0LMyJU4iZ WpH2NdaAi7trprxNy6yY188RPP9I54fDtdoR//OLfNT8cr4R4a8zpgS+8RRtyL/dVcEe 7E83qNSvAlS+dAIs2ddWWiTZHm440rwcU4KpN2XMv2Mxj+qEpzQsN+lTAFwDYXT0b4at Kubw== X-Forwarded-Encrypted: i=1; AJvYcCUajKK6LBDLJ0HeeRvLHXXjhwDAahgA1blJ5eoBVruetil9/0vbSNw8venrxWKsrfGbpG6DxbCJvvES9d2O@lists.postgresql.org X-Gm-Message-State: AOJu0Yz7IFqBx4jiOgidV3OYTSCpjDip0L64nGD5bCiYtW2q26nALyPJ 6jJ5PCcY0LHpj2/+wDaqj1LTIkv34BwdF8Gcg93usv4GSu1c7qI21/D9YZwBmhn4VABoDnV4TCs gvYz79UCoG//ettEm/rrvw5AUNryGCgQ= X-Gm-Gg: AZuq6aJ2RhCutytbOp7ChIaUBTgIS09u0fDMl4MP6AdVvMAPLFjw6SYJ7B6UPPeXd1W wJQZI4ypcFkQcS/o7WL080DdDIpDIKQfbQVLZ/Q9g4b5SXFW3WYcovmVS7Pj/Vjneo1lgnQtveF am8Bf//s3Cw5kyT87XvrQWNoq/obpWuS/ayUAERkup7akzLQB1ZqUnuEtkv83ZYbuQMPZqryh1H fCth5TlTcYnItRTYehXR1VAPKMjSHalTpmFlZpdMTnRyf3CiQfk2hDhKc6wiZBteJWJxPJF13Wr d5iFYqtbWLyiuZPTrIX3a/JoF6a7fgM5MOv8SpKO X-Received: by 2002:a05:651c:210e:b0:37b:aaf7:f022 with SMTP id 38308e7fff4ca-38846e1b817mr11708711fa.35.1771467348457; Wed, 18 Feb 2026 18:15:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Thu, 19 Feb 2026 07:45:36 +0530 X-Gm-Features: AaiRm51GprsQ8UQ2K2KLPrUP5KykQKgQyQe9YkvtVdnrcRQ7P38yoCQIUEpjKMQ Message-ID: Subject: Re: [PATCH] Support automatic sequence replication To: shveta malik Cc: Ajin Cherian , Ashutosh Sharma , 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 Wed, Feb 18, 2026 at 4:58=E2=80=AFPM shveta malik wrote: > > On Wed, Feb 18, 2026 at 1:12=E2=80=AFPM Amit Kapila wrote: > > > > On Wed, Feb 18, 2026 at 12:36=E2=80=AFPM shveta malik wrote: > > > > > > I tested a few scenarios on the latest patch. Sequence sync worker di= d > > > not stop in below scenarios: > > > > > > 1) When the subscription was disabled. > > > 2) When the only publication for sequences was dropped from > > > subscription ( ALTER SUBSCRIPTION sub1 DROP PUBLICATION pub_seq;) > > > 3) When all sequences were dropped on sub. > > > > > > Application worker stops in scenario 1, seq-sync worker should also > > > stop. See maybe_reread_subscription(). > > > > > > We need to decide the behavior of the seq-sync worker for 2 and 3. > > > > > > > Shouldn't we try to map (2) and (3) to what we do for table publication= ? > > > > I thought about it, this is what I have in mind: > > 1) When there is no sequences and tables to be synced, we will be > blocking 2 workers slot, one for apply worker and one for seq-sync > worker. While only apply-worker is enough, as it may restart seq-sync > worker as soon as it notices a sequence. > > 2) In case of apply-worker, when no tables are being published, it > hardly does any work. IIUC, it just sends responses to keep-alive > messages. OTOH, seq-sync worker will begin a transaction and query > pg_subscription_rel every few seconds. I feel, we should avoid this > unnecessary activity if possible. > > Overall, I feel the sequence sync worker is logically different from > the table apply worker. It behaves more like an auxiliary worker > managed by the apply worker and derives all of its state from the > system catalogs. > I understand that sequence-sync worker won't be doing anything useful in such corner cases but the chances of such situations are rare and the consequences are not that bad. Similarly, one can say that we can exit the launcher process when no subscription is present and the system should figure out and restart when required. In this case also, the apply-worker needs to check from time-to-time or needs to be informed to launch the new sequence-sync worker. I think we can evaluate these cases separately and can decide to write a top-up patch if found useful to make sequence-sync worker detect and exit. --=20 With Regards, Amit Kapila.