Re: subscription worker doesn't start immediately on eabled

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: peter(dot)eisentraut(at)2ndquadrant(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: subscription worker doesn't start immediately on eabled
Date: 2017-04-24 09:37:11
Message-ID: 20170424.183711.55064031.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

At Fri, 21 Apr 2017 10:15:20 -0400, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote in <77f75a90-a495-6661-68df-e4993bfac3e3(at)2ndquadrant(dot)com>
> On 4/6/17 08:24, Kyotaro HORIGUCHI wrote:
> > Hello. I found dubious behavior while playing with logical
> > replication.
> >
> > When we disable a subscription, replication worker immediately stops.
> >
> > =# ALTER SUBSCRIPTION s1 DISABLE;
> >
> > On the other hand even if we enable a subscription, worker
> > doesn't start immediately. It takes 3 minutes in the worst
> > case. (DEFAULT_NAPTIME_PER_CYCLE)
> >
> > The attached patch wakes up launcher when a subscription is
> > enabled. This fails when a subscription is enabled immedaitely
> > after disabling but it won't be a matter.
>
> What do you mean by "this fails"?

Mmm. Is the sentsnce below makes sense?

"What the patch is doing doesn't work" when a subscription is
enabled immedaitely after disabling but it won't be a matter.

Or,

It takes a short but not-zero time to shutdown a worker by
updating subenabled to false. On enablling subenabled just
after, AlterSubScription tells the backend to notify the launcher
of the update of pg_subscription on commit. But if the launcher
has not been notified that the worker is terminated, the
notification is ignored and sleep for a certain interval. (I
haven't confirmed whether it is 180s or 5s, though.)

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2017-04-24 10:24:23 Re: Cached plans and statement generalization
Previous Message Rahila Syed 2017-04-24 09:10:24 Re: Adding support for Default partition in partitioning