Re: Get stuck when dropping a subscription during synchronizing table

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Get stuck when dropping a subscription during synchronizing table
Date: 2017-06-16 08:16:39
Message-ID: CAD21AoCCAT_1qx2RQMBr0EVi7-qXdVE-QJX_=d-cLqPNjOisdQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 15, 2017 at 10:22 AM, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> On Thu, Jun 15, 2017 at 7:35 AM, Petr Jelinek
> <petr(dot)jelinek(at)2ndquadrant(dot)com> wrote:
>> On 13/06/17 21:49, Peter Eisentraut wrote:
>>> On 6/13/17 02:33, Noah Misch wrote:
>>>>> Steps to reproduce -
>>>>> X cluster -> create 100 tables , publish all tables (create publication pub
>>>>> for all tables);
>>>>> Y Cluster -> create 100 tables ,create subscription(create subscription sub
>>>>> connection 'user=centos host=localhost' publication pub;
>>>>> Y cluster ->drop subscription - drop subscription sub;
>>>>>
>>>>> check the log file on Y cluster.
>>>>>
>>>>> Sometime , i have seen this error on psql prompt and drop subscription
>>>>> operation got failed at first attempt.
>>>>>
>>>>> postgres=# drop subscription sub;
>>>>> ERROR: tuple concurrently updated
>>>>> postgres=# drop subscription sub;
>>>>> NOTICE: dropped replication slot "sub" on publisher
>>>>> DROP SUBSCRIPTION
>>>>
>>>> [Action required within three days. This is a generic notification.]
>>>
>>> It's being worked on. Let's see by Thursday.
>>>
>>

I've reviewed these patches. 0001 patch conflicts with commit
a571c7f661a7b601aafcb12196d004cdb8b8cb23.

>> Attached fixes it (it was mostly about order of calls). I also split the
>> SetSubscriptionRelState into 2 separate interface while I was changing
>> it, because now that the update_only bool was added it has become quite
>> strange to have single interface for what is basically two separate
>> functions.

+1 from me, too.
A subscription relation state may have been removed already when we
try to update it. SetSubscriptionRelState didn't emit an error in such
case but with this patch we end up with an error. Since we shouldn't
ignore such error in UpdateSubscriptionRelState I'd say we can let the
user know about that possibility in the error message.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2017-06-16 08:55:45 Re: pg_waldump command line arguments
Previous Message Kyotaro HORIGUCHI 2017-06-16 08:16:08 Re: Adding support for Default partition in partitioning