Re: [HACKERS] Somebody has not thought through subscription lockingconsiderations - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] Somebody has not thought through subscription lockingconsiderations
Date
Msg-id 2299a476-07ec-ac85-fd04-3ae79cb7dd94@2ndquadrant.com
Whole thread Raw
List pgsql-hackers
On 3/31/17 20:25, Petr Jelinek wrote:
> On 01/04/17 01:57, Petr Jelinek wrote:
>> That being said, looking at use-cases for SetSubscriptionRelState that's
>> basically CREATE SUBSCRIPTION, ALTER SUBSCRIPTION REFRESH and tablesync
>> worker. So the DDL thing applies to first ones as well and tablesync
>> should not be running in case the record does not exist so it's fine if
>> it fails. In terms of RemoveSubscriptionRel that's only called from
>> heap_drop_with_catalog and tablesync holds relation lock so there is no
>> way heap_drop_with_catalog will happen on the same relation. This leads
>> me to thinking that RowExclusiveLock is fine for both
>> SetSubscriptionRelState and RemoveSubscriptionRel as long as we document
>> that callers should be aware that SetSubscriptionRelState has
>> concurrency issues and fail on unique index check.
>>
> 
> And a simple patch to do so. Peter do you see any problem with doing this?

committed

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] recent deadlock regression test failures
Next
From: Andres Freund
Date:
Subject: Re: [HACKERS] "left shift of negative value" warnings