Re: Cannot shutdown subscriber after DROP SUBSCRIPTION

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: michael(dot)paquier(at)gmail(dot)com
Cc: masao(dot)fujii(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Cannot shutdown subscriber after DROP SUBSCRIPTION
Date: 2017-02-02 03:02:15
Message-ID: 20170202.120215.152968214.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Thu, 2 Feb 2017 08:46:11 +0900, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote in <CAB7nPqR6VQ7aiKck1Ao3_mPVvn4v4ZKnJFq2oawFqpaePHd18A(at)mail(dot)gmail(dot)com>
> On Thu, Feb 2, 2017 at 2:14 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> > The lwlock would be released when an exception occurs, so I don't think
> > that TRY-CATCH is necessary here. Or it's necessary for another reason?
>
> + PG_CATCH();
> + {
> + LWLockRelease(LogicalRepLauncherLock);
> + PG_RE_THROW();
> + }
> + PG_END_TRY();
> Just to do that, a TRY/CATCH block looks like an overkill to me. Why
> not just call LWLockRelease in the ERROR and return code paths?

I though the same first. The modification at the "if (wrconn =="
is the remains of that. It is reverted inthe attached patch.

Then, the reason for the TRY-CATCH cluase is that I found that
some functions called from there can throw exceptions.

logicalrep_worker_stop and replorigin_drop have ereport in its path.
load_library apparently can throw exception.
(walrcv_(libpq_) functions don't seeem to.)

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-Fix-DROP-SUBSCRIPTION-s-lock-leak.patch text/x-patch 3.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-02-02 03:03:20 Re: pg_background contrib module proposal
Previous Message Michael Paquier 2017-02-02 03:01:27 Re: sequence data type