Re: Get stuck when dropping a subscription during synchronizing table

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: peter(dot)eisentraut(at)2ndquadrant(dot)com
Cc: sawada(dot)mshk(at)gmail(dot)com, petr(dot)jelinek(at)2ndquadrant(dot)com, tushar(dot)ahuja(at)enterprisedb(dot)com, robertmhaas(at)gmail(dot)com, michael(dot)paquier(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Get stuck when dropping a subscription during synchronizing table
Date: 2017-06-22 06:03:19
Message-ID: 20170622.150319.06577238.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

At Wed, 21 Jun 2017 22:43:32 -0400, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote in <501f75c9-c5d6-d023-add0-3b670ac86de2(at)2ndquadrant(dot)com>
> On 6/20/17 19:10, Peter Eisentraut wrote:
> > On 6/19/17 22:54, Masahiko Sawada wrote:
> >>> It seems to me we could just take a stronger lock around
> >>> RemoveSubscriptionRel(), so that workers can't write in there concurrently.
> >>
> >> Since we reduced the lock level of updating pg_subscription_rel by
> >> commit 521fd4795e3e the same deadlock issue will appear if we just
> >> take a stronger lock level.
> >
> > I was thinking about a more refined approach, like in the attached
> > patch. It just changes the locking when in DropSubscription(), so that
> > that doesn't fail if workers are doing stuff concurrently. Everything
> > else stays the same.
>
> The alternative is that we use the LockSharedObject() approach that was
> already alluded to, like in the attached patch. Both approaches would
> work equally fine AFAICT.

However I haven't seen this deeply, just making
SetSubscriptionRelState exlusive seems to have a chance to create
a false record on pg_subscription_rel. Am I misunderstanding?

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-06-22 06:10:53 Re: Autovacuum launcher occurs error when cancelled by SIGINT
Previous Message Michael Paquier 2017-06-22 05:55:30 Re: archive_timeout ignored directly after promotion