Re: [HACKERS] subscription worker doesn't start immediately oneabled - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject Re: [HACKERS] subscription worker doesn't start immediately oneabled
Date
Msg-id 20170424.183711.55064031.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
In response to Re: [HACKERS] subscription worker doesn't start immediately on eabled  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
Hello,

At Fri, 21 Apr 2017 10:15:20 -0400, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote in
<77f75a90-a495-6661-68df-e4993bfac3e3@2ndquadrant.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 isenabled 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




pgsql-hackers by date:

Previous
From: Rahila Syed
Date:
Subject: Re: [HACKERS] Adding support for Default partition in partitioning
Next
From: Alexander Korotkov
Date:
Subject: Re: [HACKERS] Cached plans and statement generalization