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 1vo8K2-00FlgG-04 for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Feb 2026 22:59:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vo8J0-001ATo-0d for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Feb 2026 22:58:34 +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 1vo8Iz-001ATf-2A for pgsql-hackers@lists.postgresql.org; Thu, 05 Feb 2026 22:58:33 +0000 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vo8Ix-00000000kgo-2PSr for pgsql-hackers@postgresql.org; Thu, 05 Feb 2026 22:58:32 +0000 Received: by mail-qt1-x830.google.com with SMTP id d75a77b69052e-505e2e4c35fso14445601cf.3 for ; Thu, 05 Feb 2026 14:58:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1770332310; cv=none; d=google.com; s=arc-20240605; b=Cpf/uuub2TP8GMIGkf3/b9MLZE293DgEC3bwKDCNHF7lIwN13jqMeThf40w8N4Wdhl 5HeObr5jSQZ0W5aKH3iWU/vOp6MZOmdvIzNjkmdhfmSjTO2wXHXsqdto+/zQvh7DQ8pi S+EJw/lOlJjtlORD/kbe4f2KSaonSxZ2Y3eGrrbLDZXJunrfFtwaL3XsG5vCKPqOoSUg yMgHlJmk/aA41IHm46VoLMdbu0WrDV0gJf/k07KhtHq71AUwGSeAJoqa2B9Gs3YqpbP5 jCPfNKOfJkwOA1wxg771TYpy/HUyjXCRS0afxWtXNe5bLihPLIAjxSv7yHiVeP3Dwzoy U9Tg== 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=dOQiWuMnIU12rF4zEM3IT/HkRToXZREWj1b0BMUbEe0=; fh=E1YuHV4zQf7xx5MW98T0GUU4SZJJLPOCa4yc+YUS5wo=; b=KASiW1tFciYBb9LFK3HqErDoqHLkId6I3fCjyedtYNqbRn+9ZV8eC/oeIDuJXJkBqR 7n3OACo4hrgHicdapFi2AEY0udUhhON3xRLnOWOliaIDsH59Av6/10LqXbkGWRqUzDXZ 5UmRaeU9p5Wkta6b2CL6S/w06jAGIxQd0lyOeb1FRA3M1LWDVjl24/GbB6ME/DzAz1YM gBWzCK1Cv0p+CdoWa1REuCGTvAxiUCSQBgti3wlNhE+q9ZQecvYqxooFmwN4WxaRP/6t +efPCGSBlLBpCB+Qs9bGFtgDzk0mVQvA9hwCnAA8UvwzXf4YmVpCQfZPUPrZpEorPDgN addA==; 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=1770332310; x=1770937110; 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=dOQiWuMnIU12rF4zEM3IT/HkRToXZREWj1b0BMUbEe0=; b=QrbTwvjWmuYKsPY3JGa43gsaSLIZyrOxfsCuQ+G1wkaR7M5C0fNxMnM63JUF3L2Tkh 2alDovg+ys4S9yWrQGMcDFRqBTUDazmHPHXfPuInMzG0DP5v7mQwQyGudDZPZELZ/sTh 7K3XKyrSJnOaU1r0uM5DcM/eb+ehNZwI6dVvMOiMDuErg2aiLT5iiw58y5myxHhLstqM Hisi7Potif5jkCaYgjULwf7Iy9ymvwaKPxVS1k9zKgwvcc7BLKTCd5J67y9GNXLww2ns rXZgv5S5NWU4ozUsJCMzYV9EYDyqBx9mmuvAkz3ndZ/tfmjmlGalFrgl3ldaRWKxxlPG UCdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770332310; x=1770937110; 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=dOQiWuMnIU12rF4zEM3IT/HkRToXZREWj1b0BMUbEe0=; b=J7/l1c4IXRMkSUpQoLunnGDg/n2LZwHVFI5Q4iN58exE64ubu0rNmFHtrjbog+/o0W 5BpOXuKYb9uaZZ9wm7RiIg0FDEYy35gP9OcMrXZaKjq77PR1+p0qA4XfqTZA//Odsjvy u/9XDuItD0Fp5nWTy23e3O4xMInM8PhK8oJmrh2wFscMRqBYrD5+wGuJrTwYKek53KbD 3UpA1Ms+tjS64kDJXiiHVNEr52XL4p2Y+LWL4+CVsKfvaRbbyk4ttacRUBRJYbcIYshE Jtsm+zizpzzCAzINapZQVWQB0FrpT2cwz7jgkkemnisl2G16CkTlWhb/iI0uldENNgrh 2K4A== X-Forwarded-Encrypted: i=1; AJvYcCXRHkV5Vdvc6DIct8cskgq+X5kKjS1Jjaaz9zkvYZ0/KCbPmmQrSohdGCcdvuAEiyIookQuclsyq9Sjk5cA@postgresql.org X-Gm-Message-State: AOJu0Yz0Qe2PVXH9Fhb3hWWaUNmsckk+mYPxsF9IT4AmSth8j4ZaNIKH i9cPOwTt47q+od9lQS7L6eQM7Wnua9OmMF2/+g4rN2wg5c27u8w8onBLXkX5FhTIH5Cga1bu3np ZgNo60TcFzqYhfu0sMhwlvn1jywtTEtQ= X-Gm-Gg: AZuq6aItK4sgORq1xyODkQ74niQUUoz7UTZ23bvG8eFhxPu49CM9LeCHJN1Cp6X0KQp TjUV1vhiCu0fFl2JEFWU02BbGHLuDLDfAmMwGYlyWs6MP++1wBi9WHAI7pdMRJ2ZnpEiQ4dNzpd u2OmOCo/pfBYP3+AzZRuWCn6RZ1Fk4enbcEfnDrErbjD7gD0rBQ7vPgD73O1VRe0bfiw/1mE/iX HV3765Fftt9rIC2ABANOa3X4IoRg88bNnAokZAT9mTjSvCQn/cn4G+e+V6EFCpXy/OVbudEgzyV dxx1PDAkAWGsrMh96JEGAXH2WTs8GQ== X-Received: by 2002:ac8:7fcf:0:b0:503:2c49:34b0 with SMTP id d75a77b69052e-50639a01b8emr10257331cf.62.1770332310033; Thu, 05 Feb 2026 14:58:30 -0800 (PST) MIME-Version: 1.0 References: <20260204140731.0e4b511906ac748abad1f3d9@sraoss.co.jp> <20260205101239.3c432a7766bc962bad9c6c51@sraoss.co.jp> In-Reply-To: From: Peter Smith Date: Fri, 6 Feb 2026 09:58:02 +1100 X-Gm-Features: AZwV_QiAVRiSdwnx0h9p5K1yLJfnLeyBKMvjHHvvGrHd8o1vVXJgnWh3HzhFHPo Message-ID: Subject: Re: Warn when creating or enabling a subscription with max_logical_replication_workers = 0 To: "Zhijie Hou (Fujitsu)" Cc: Yugo Nagata , 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 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 "worker= s", but in > > fact, because max_logical_replication_workers =3D 0 the main "logical > > replication launcher" process had failed to start, so logical replicati= on 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 wan= t to know > > is just whether that "logical replication launcher" is running or not. > > > > And that launcher pid is already tested when the Subscription commands = 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 mig= ht fail > for some reasons and restart soon (pid will be set to 0), in which case t= his > 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 launcher cannot "fail" because it was never registered/started in the first place. > > 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. e.g. when max_logical_replication_workers =3D 1 ---------- test_sub=3D# create subscription sub1 connection 'dbname=3Dtest_pub' publication pub1; NOTICE: created replication slot "sub1" on publisher CREATE SUBSCRIPTION test_sub=3D# 2026-02-06 08:50:35.306 AEDT [629942] LOG: logical replication apply worker for subscription "sub1" has started 2026-02-06 08:50:35.348 AEDT [629942] WARNING: out of logical replication worker slots 2026-02-06 08:50:35.348 AEDT [629942] HINT: You might need to increase "max_logical_replication_workers". 2026-02-06 08:50:40.356 AEDT [629942] WARNING: out of logical replication worker slots 2026-02-06 08:50:40.356 AEDT [629942] HINT: You might need to increase "max_logical_replication_workers". 2026-02-06 08:50:45.365 AEDT [629942] WARNING: out of logical replication worker slots 2026-02-06 08:50:45.365 AEDT [629942] HINT: You might need to increase "max_logical_replication_workers". 2026-02-06 08:50:50.426 AEDT [629942] WARNING: out of logical replication worker slots 2026-02-06 08:50:50.426 AEDT [629942] HINT: You might need to increase "max_logical_replication_workers". 2026-02-06 08:50:55.531 AEDT [629942] WARNING: out of logical replication worker slots 2026-02-06 08:50:55.531 AEDT [629942] HINT: You might need to increase "max_logical_replication_workers". ... ---------- =3D=3D=3D=3D=3D=3D Kind Regards, Peter Smith. Fujitsu Australia