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 1vsfjQ-00DArX-0v for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Feb 2026 11:28:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vsfjP-00Fgl6-1P for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Feb 2026 11:28:35 +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 1vsfjP-00Fgky-0H for pgsql-hackers@lists.postgresql.org; Wed, 18 Feb 2026 11:28:35 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vsfjM-00000001Cx8-2nwc for pgsql-hackers@lists.postgresql.org; Wed, 18 Feb 2026 11:28:34 +0000 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-352e3d18fa7so2080398a91.1 for ; Wed, 18 Feb 2026 03:28:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771414113; cv=none; d=google.com; s=arc-20240605; b=TOudbA4frZHvfEfq6N8dNitYfeHjHXO9K6DAqJ3CVl6fCH/S1grWFgyGWI6woMh9TV 8HF0vhutCms7toYAEYIKpz6V8AMnTpIBeFIbcOZqvtHXfA0vTmdlK0DouWf2erA4BQAS B0HTulygnBBmyMGEXH3p4Wci/9TmlYKaXRdscQxuCAP+BC1B2wGkf+cebiaInSktYn/x z4WIkIf9aMkdKAzMhpNB1tbPFm5CyQ4gjjLaexE99Yy5/1U5bdAiWC8Z+JJqNRxS3usE eEEn9LM256ATbx4ic5LyUB0lW5B0vDuW9lHGTfZl9jVnVgptzL7m2BUx4j8tBukbsLXb J1vw== 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=C1ZhN7YA5WfH/UpMqvUep/XaIpOuJbHdEPRUESwpqvs=; fh=DU24HOY3cKBmP/3c7jsd98/woXYsdevD21FosbroL9Y=; b=JLwRsPxfM2YTbHw4OsAhKSABi1R5Md0hk7bT3Oqxn/WsdyHNb4EbEdDBiHiMj5hyr0 xZJfCJW/7Re/Ouyhm5u0sPO6w3W0gFx1gfdziyy20AJcyKFps0zD/GhWt8F8oIehF4g1 /MHPZReySA73rQP3OZ+AHzIpN9Vifaj0YAKXEJ+hPHbtm/E7ScErL7cQdaGaCTo5A7fl r96MDNAtpYScNVf+4hf35145hRHn/jOPZh1aeeDcpW9kkLHSyBcXOM6D/fRIf2NpVoYe 5xVk3nyNG7Fyt6YlCRcuKR5vqilT7eG0hu9mKkZddyuQiqsRDXS212ANUtaS5TWm3fQF x4CA==; 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=1771414113; x=1772018913; 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=C1ZhN7YA5WfH/UpMqvUep/XaIpOuJbHdEPRUESwpqvs=; b=VNa3GibC+0l8vaSRLYeXxizRqGSeFPGGQsxMAAGfAilNQaxlC3srVnC/5Ydl+VZR2c 5vFV8RYIQjThFh9s0P4o6/85QkUUPSoyOWS9poljEXMY+/8IY1jKjDZzHO8cQNpBHnhS f9vkvBm/Lz+OKh0RJo8Y1+tvQ7JlcfAz05Bd3rKh7CihLMEHKLQ4ZxqShqfyZ3LHHDcg UwdUqHzIz6/prGGzycSbNE2GwtJNd4vWyi9mnYoAtSCIGPoIFB9M0AupnD/ONY+Dxfol AN9juR+yOyIa/k1ytF6RqU7Dsr9+f2ISpK/9OGY4/Mlcnp3+G8BE4vcmu003VJdgXviU vGIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771414113; x=1772018913; 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=C1ZhN7YA5WfH/UpMqvUep/XaIpOuJbHdEPRUESwpqvs=; b=AdFOdiree9UHlvpcEHbdnuMHlQ2wnLjxWe2YEjRj8050V3K/ZSsWxZLqgiW8y2KEk/ cGggnlDlid3ZH3agudp5f5O6NQVxAHPvOKiBY/b2x62/C963esya/OJiR3JaD8gO6ZQc YPXXcERYlQnPJwpkMD7+JvqNrKXOnhQK5+qOHu1GtdfjwhSpG0BfyGwjFWHKEQgkDnfo kQLg6CE2N5l7KWBsny35vEaTIMBMkiqZP0c0/QSOsW64G9O8ZmoPXw8dzh0V5BE7J1iV qE148gAUQylm5MzuwNQkdZ6JLk0Z/TugmMPucnRczYZOdB2ZcM/C6zTuhsoDTh9HPabn kbNA== X-Forwarded-Encrypted: i=1; AJvYcCUTvsfd0QHlnPuR+/yhDlgILH6O3LrZE1oKfNoFBCVCVHDgQf8CXGz64DSrCng7VzZUog5KLR4Hdl5aEtMr@lists.postgresql.org X-Gm-Message-State: AOJu0YxX8p20iXYrLPzR01mi+VJ3RFMQtsYbQY2Ox+CshpntkwJtJh+m Z+96YpC7R50j8wOIhbG+oaldlv7prLTXmjGIkdgLCV+gN7Kk2/fmp/UXLRxS3/UqNinVsvq+5BE ++bfiYtWFOo4rodBxWKIdNFA3sg9Uj1Q= X-Gm-Gg: AZuq6aJjZ+T/Yy20yLKtm4h2wfLKHnS+c9brsqfaoXwZ0ZaF7c+X84j15IhRWNyPXPv 8msiuZIF/JFEWSg15v4Qweqo90NSkiWIjVI07hCQ6JFcNN0IbiMsMC9gWn0Bkcgs3YRSKcUBCNH iQrauxPUb4qcLm+6BljlkKezvEFIrVDfwlkIoKi149XFfoscMuqJLoKQlC+5pqpsMrNmb+gJOsV 8re20FTgUAyF6+z2mGKa6Nv6MY7d6a5JnxHWxgSk3nAAkmdq0yIEwF+fbvCW6H54XAj4VeYCJ/x /k8SZz0PMkRQUe1exmaEoiPgt0cFQM5bvQL7rM+l+69uZct5Gs/42kTi8L846FIbTPBflOzfxEv 9pcV+9Ew= X-Received: by 2002:a17:90b:2cc4:b0:356:2b1c:f629 with SMTP id 98e67ed59e1d1-3588917386cmr1188250a91.22.1771414112591; Wed, 18 Feb 2026 03:28:32 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: shveta malik Date: Wed, 18 Feb 2026 16:58:20 +0530 X-Gm-Features: AaiRm51uT7rKgK0a3mOHaYOzfuoIgtIQtni5airw5W7eynqwT7czHDYhQxuYfM0 Message-ID: Subject: Re: [PATCH] Support automatic sequence replication To: Amit Kapila Cc: Ajin Cherian , Ashutosh Sharma , 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, 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 did > > 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. In contrast, the apply worker actively consumes the logical replication stream and is responsible for advancing the slot and origin. If the apply worker is stopped for an extended period, the slot cannot advance, which may lead to WAL accumulation on the publisher. There is no such constraint associated with the seq-sync worker. And thus stopping the seq-sync worker aggressively (in scenarios 2 and 3) is both safer and simpler as compared to apply worker and will also avoid some unnecessary transactions and activity as I stated above. Thoughts? thanks Shveta