Re: Warn when creating or enabling a subscription with max_logical_replication_workers = 0

Поиск
Список
Период
Сортировка
От Dilip Kumar
Тема Re: Warn when creating or enabling a subscription with max_logical_replication_workers = 0
Дата
Msg-id CAFiTN-um8r_QrsPjU6noH5YJ0u0atBGfYxBpYPx_coBvxoLpbA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Warn when creating or enabling a subscription with max_logical_replication_workers = 0  (Yugo Nagata <nagata@sraoss.co.jp>)
Список pgsql-hackers
On Thu, Feb 5, 2026 at 6:42 AM Yugo Nagata <nagata@sraoss.co.jp> wrote:
>
> On Wed, 4 Feb 2026 17:26:25 +1100
> Peter Smith <smithpb2250@gmail.com> wrote:
>
> > On Wed, Feb 4, 2026 at 4:07 PM Yugo Nagata <nagata@sraoss.co.jp> wrote:
> > >
> > > Hi,
> > >
> > > I would like to propose emitting a warning when creating or enabling a
> > > subscription while max_logical_replication_workers is set to 0. In this
> > > case, the CREATE/ALTER SUBSCRIPTION command completes successfully without
> > > any warning, making it difficult to notice that logical replication cannot
> > > start.
> > >
> > > Of course, users can confirm whether logical replication is working by
> > > checking system views such as pg_stat_replication or pg_stat_subscription.
> > > However, emitting warnings explicitly in these cases would make this
> > > situation more visible. We have seen user reports where this behavior
> > > caused confusion, with users wondering why replication did not start.
> > >
> >
> > Hi Nagata-San.
> >
> > AFAIK the default for `max_logical_replication_workers` is 4. So how
> > does the maximum get to be 0 unless the user had explicitly configured
> > it that way?
>
> That's correct, but the goal here is simply to make it easier for users to
> be aware of this condition, since the current behavior provides no
> indication that replication will not start.
>
> > Also subscriptions require multiple workers in order to work properly
> > [1] so why check only 0? Why not check 1 or 2 or 3.... those low
> > numbers are also likely to cause similar problems aren't they?
> >
> > And what about when the  `max_logical_replication_workers` is 100, but
> > those 100 are already being used. IOW, would it be more useful to warn
> > when you do not have enough *available* workers for the Subscription
> > to function properly, rather than checking what the maximum value is
> > set to?
>
> When max_logical_replication_workers is zero, the logical replication
> launcher will never start. Otherwise, it does start and emits the
> following warning to the server log when workers cannot be obtained:
>
> WARNING: out of logical replication worker slots
> HINT: You might need to increase "max_logical_replication_workers"
>
> Given this, I think it is sufficient to warn only when
> max_logical_replication_workers is zero.

Wouldn't it make sense to emit a WARNING if there are no worker left
to be launched for the SUBSCRIPTION?

> That said, this warning is currently emitted only to the server log and
> does not appear as a response to CREATE/ALTER SUBSCRIPTION. However, I'm
> not sure whether emitting a similar warning as part of the
> CREATE/ALTER SUBSCRIPTION response would add much value.

Yes, I think it would make more sense to emit WARNING during
CREATE/ALTER SUBSCRIPTION command as well.

--
Regards,
Dilip Kumar
Google



В списке pgsql-hackers по дате отправления: