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 1voGGb-00HahD-24 for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Feb 2026 07:28:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1voGGa-002Wkt-2T for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Feb 2026 07:28:36 +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 1voGGa-002Wkk-17 for pgsql-hackers@lists.postgresql.org; Fri, 06 Feb 2026 07:28:36 +0000 Received: from mail-qv1-xf32.google.com ([2607:f8b0:4864:20::f32]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1voGGY-00000000nzu-1TOo for pgsql-hackers@postgresql.org; Fri, 06 Feb 2026 07:28:35 +0000 Received: by mail-qv1-xf32.google.com with SMTP id 6a1803df08f44-894674a4c4aso7131726d6.3 for ; Thu, 05 Feb 2026 23:28:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1770362913; cv=none; d=google.com; s=arc-20240605; b=icgCNue8brKr6BxLvXCscvyL8Emqm93gluM6mjzEKmo1dnOwICPgxU4wKdBmEOhdo1 4IDKOix0UpQXY/YQpcVjImSAnoXp6ROud75xpmynAMiPemkJQ42ky7dLXwfv/aC43M3X doOFvopxwSEVrZgMRu0p2PB4BMbWiTk1Yjwr8YH5qMg5Q+BedpFbFqh3wOlJnME2QFM2 fa4f/kvccTT1u4glW8NA+36EPdJDm6EULkKzEnQQXWx4NQuSp+D1Lg9UD/YBkBh6pUj/ 5nNX/ejRMAgALlh6By474kG8UEMO/8JAX6G8+o/Llcbkbfn5z19dKXYiHq+umgo+ZiuW 0Dpw== 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=O0lwtsKIybQzvkXc2jiojV1AuswTBapVLIkHJWMbAQQ=; fh=ysGDu7y5hLxWlq21kr8zsrqVvaQZivcb5zkFm41WS7U=; b=cUGhIPb/t//8TOAnibqLXI4aggcu0+p5+VzER8vLRSUzjMBkFrpwBXX/Qr7SQScLDF qqyhJLRTWC0r0ZH6UyVCfV1ymWcy4s2CilsEqRip3vKzFKZmHm340Omb2CmYP+J64KB6 GiXBfvGUV4JlBKX2fiBZfCMT25d6RMo1A4jAXY3Qp57YZTHnIBB8zHSptGQeJcEORmVX TMymjc+jNV9VJuUeQpMZ2Fn4raqTbzfTiPaPa90Xgcg+7zkMRx/sNFMIOl8aD3DwQIcX 3xdKYsGGa8AEVAo7ovsCyDljQUlMcgxcxbzkx57/R718gkyFMRJ/aJq5Rq4Q+2fs31de IjjA==; darn=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=1770362913; x=1770967713; darn=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=O0lwtsKIybQzvkXc2jiojV1AuswTBapVLIkHJWMbAQQ=; b=WabdW6ccq8+Hi63eZg/clQkyhhKwdRnoAVdI9DER2U/MiX5+2NK8VcRpsZJVDhfWIQ CpfnR9s72X4uHwh06jSuU8GlF1kvUkwO9AKsFs4y+S12PEuZLY7dBASQ9GoPM7veX02D TIhDNGBG5ZtwUJJVU8MF0uD3/1gYmbccBLlferc1fcbdQeLtqMbUsUnFOJwrRF7AGM1H OnchXkCYgjAK1MXhdyYpICR2yLRHlF+sRzSuDUNN7/Hbh8BpGHz+SkkVQLpc736m8H2P 300yCZxnmwiSscRCy2zZ9LYpZ81u2kSOPMLD9k4jX8arXfi5jK1RcmRsXXVH7POqVy7O GEdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770362913; x=1770967713; 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=O0lwtsKIybQzvkXc2jiojV1AuswTBapVLIkHJWMbAQQ=; b=A4APK1HqqqndPTyN530lhu/BvuPnBwFggqqKehBuWROO6FS/ZHhNbbQLZV7U1zTgIC iO8vYts43hM0fCFKZR+wmbf+LIslofl8nfQsQN3kfh/Bl7ev/4Rw88Yr/94iGgg0LM3Q BFMPo8jvz/PUCSsts4Xvu/a4myMk919TdtUfzUbR+zkqaMKynWHV1tUSgdAwL+uD/e+a JqdAfwpuSSM4+tjKQV4tIDirStV014FKBpxLCyaHapbaODH6+Ohy7XRaarP7A9i8TSOO iZ7VgBnFZtw9pZr+Lh03lVXwbiOLQCFNzlkBjxGYHznSB7vWTr9yuNYccvd37UNL8y9n nc1g== X-Forwarded-Encrypted: i=1; AJvYcCWY9YK0A1/wuqDNjetJ4a2x7w+tktx5qCaC3CkVvA7jEKNTDPuyeS5rOxpwMFjxoZvUZdW20Au1jI7VyvaD@postgresql.org X-Gm-Message-State: AOJu0YyNFzDw91958OiG+uZGPSy/sSvQZd50YYIxJuWlEsBkUAf+8OD4 pc9KxybjCfFHMyrwURG6AGlW70NtKxas5VPZ87Kn+QQr7CWv7IQp92LnmxJwyyxaL0KFOvsm1sn 10T2jQnWc+/3z7bcpm+bIIdbS+GpXwLk= X-Gm-Gg: AZuq6aJDj9NNQYMFxy+xMCetEyDQ0/M0M3htlcK72cC8BOtEVlYXR04I2JHdz09qqci t/evz51LTkE1t8swCr6lvb2lG9ciIAv8WR04a5q5fC579hbkxnOj71ARUV+DEHqmw9wuu3uZQc9 Pe9/Mr70ICdNdLYGN8pzslM/a07qgLUzcoNYAuc4Uie60lnmZh7uE/t69mhcWILxFgZG+yH231F NWr3gfzHaFZk7qLdq58a3Frf792CbAilGv77PDfKxoU7BLQ7b1Ji5rRMzrv/SgQPkH4W9I= X-Received: by 2002:ac8:59d0:0:b0:4f4:e15e:528f with SMTP id d75a77b69052e-50639975eb8mr20988281cf.62.1770362913211; Thu, 05 Feb 2026 23:28:33 -0800 (PST) MIME-Version: 1.0 References: <20260204140731.0e4b511906ac748abad1f3d9@sraoss.co.jp> <20260205101239.3c432a7766bc962bad9c6c51@sraoss.co.jp> <20260206133735.5aff1862e35a2c21397574ce@sraoss.co.jp> In-Reply-To: <20260206133735.5aff1862e35a2c21397574ce@sraoss.co.jp> From: Peter Smith Date: Fri, 6 Feb 2026 18:28:06 +1100 X-Gm-Features: AZwV_QibH0WQLxqz0hj9etx6cM2tdtkXuOEM4XG4pFViHczMIVRxBJ_89UbNISk Message-ID: Subject: Re: Warn when creating or enabling a subscription with max_logical_replication_workers = 0 To: Yugo Nagata Cc: "Zhijie Hou (Fujitsu)" , Pgsql 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 Fri, Feb 6, 2026 at 3:37=E2=80=AFPM Yugo Nagata wr= ote: > > On Fri, 6 Feb 2026 09:58:02 +1100 > Peter Smith wrote: > > > On Thu, Feb 5, 2026 at 7:12=E2=80=AFPM Zhijie Hou (Fujitsu) > > wrote: > > > > > > On Thursday, February 5, 2026 3:47 PM Peter Smith wrote: > > > > On Thu, Feb 5, 2026 at 12:12=E2=80=AFPM Yugo Nagata wrote: > > > > > > > > > > On Wed, 4 Feb 2026 17:26:25 +1100 > > > > > Peter Smith wrote: > > > > > > > ... > > > > > > > > Oh right, I mistook that you had run out of logical replication "wo= rkers", but in > > > > fact, because max_logical_replication_workers =3D 0 the main "logic= al > > > > replication launcher" process had failed to start, so logical repli= cation was > > > > entirely disabled. > > > > > > > > See code: in backend/replication/logical/launcher.c > > > > > > > > ApplyLauncherRegister(void) > > > > { > > > > ... > > > > if (max_logical_replication_workers =3D=3D 0 || IsBinaryUpgrade) > > > > return; > > > > > > > > ~~~ > > > > > > > > Given this, I felt that instead of testing the GUC, what you really= want to know > > > > is just whether that "logical replication launcher" is running or n= ot. > > > > > > > > And that launcher pid is already tested when the Subscription comma= nds send > > > > a "kill" to the launcher. e.g. see function ApplyLauncherWakeup. > > > > > > > > So, here is a diff patch, of what I tried: > > > > > > > > ------ > > > > diff --git a/src/backend/replication/logical/launcher.c > > > > b/src/backend/replication/logical/launcher.c > > > > index 3ed86480be2..f880380ce4e 100644 > > > > --- a/src/backend/replication/logical/launcher.c > > > > +++ b/src/backend/replication/logical/launcher.c > > > > @@ -1195,6 +1195,13 @@ ApplyLauncherWakeup(void) { > > > > if (LogicalRepCtx->launcher_pid !=3D 0) > > > > kill(LogicalRepCtx->launcher_pid, SIGUSR1); > > > > + else > > > > + { > > > > + if (max_logical_replication_workers =3D=3D 0) > > > > + ereport(WARNING, > > > > + errmsg("Logical replication is > > > > currently disabled"), > > > > + errhint("\"%s\" is 0.", > > > > "max_logical_replication_workers")); > > > > + } > > > > } > > > > ------ > > > > > > > > Thoughts? > > > > > > I think this is not the right place to check this issue. The launcher= might fail > > > for some reasons and restart soon (pid will be set to 0), in which ca= se this > > > warning wouldn't be appropriate. > > > > AFAIK, that's not possible. My warning is guarded by checking > > max_logical_replication_workers =3D=3D 0. And in that case, the launche= r > > cannot "fail" because it was never registered/started in the first > > place. > > I also initially considered emitting the warning in > ApplyLauncherWakeup() after checking=E3=80=80max_logical_replication_work= ers =3D=3D 0. > However, I think checking pid =3D=3D 0 is sufficient. > > Even when max_logical_replication_workers is non-zero and the launcher is > normally running, it could still be killed by user action or by the > OS, although such cases should be rare. In that situation, emitting the > same warning would not be appropriate. Sorry, I did not understand the previous paragraph. If "when max_logical_replication_workers is non-zero" then the warning cannot be emitted inappropriately because that warning is guarded by "if (max_logical_replication_workers =3D=3D 0)" (??). > > I placed the logic in subscriptioncmds.c so that the warning message can > better reflect the actual situation, while keeping consistency with > existing messages such as "subscription was created, but is not > connected". In hindsgght your original patch is very similar to what I posted. I agree, your messages are better because they are more specific. But there are multiple calls to ApplyLauncherWakeup() -- not just those 2 that you handled - so I was just unsure if there are some remaining holes. > > > > > > > Besides, I also think it would make more sense to issue a warning if = the > > > subscription has no remaining workers to start instead of raising a > > > warning for 0 setting (the latter seems rare). > > > > > > > It might be rare, but by my understanding, the original post described > > this specific scenario, whereby the user had previously deliberately > > configured `max_logical_replication_workers` to 0. Then, some time > > later, when they attempted CREATE/ALTER SUBSCRIPTION, nothing > > happened, and there was only silence. If they'd forgotten about their > > `max_logical_replication_workers` setting, then it could be confusing > > why nothing was happening. > > > > OTOH, when max_logical_replication_workers > 0, then the logical > > replication launcher would be running, and in that case, there are > > already plenty of warning logs about not enough worker resources. > > Yes. In this case, warnings are emitted to the server log, but they do no= t > appear as a response to CREATE/ALTER SUBSCRIPTION. There is an option to > also emit such warnings during the CREATE/ALTER SUBSCRIPTION command, so > I will update the patch accordingly. > > Nevertheless, this seems to be a different situation from the case where > logical replication is disabled entirely, so I think the warning messages > should be handled separately. +1. I also think that running out of worker resources is a different scenario from the entire logical replication being disabled, so it should be handled separately =3D=3D=3D=3D=3D=3D Kind Regards, Peter Smith. Fujitsu Australia