Re: tablecmds.c and lock hierarchy - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: tablecmds.c and lock hierarchy
Date
Msg-id 20150804172320.GS2441@postgresql.org
Whole thread Raw
In response to Re: tablecmds.c and lock hierarchy  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: tablecmds.c and lock hierarchy  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
Michael Paquier wrote:
> On Tue, Aug 4, 2015 at 2:43 PM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:

> > Maybe the solution to this is to add the concept of "addition" of two
> > lock modes, where the result is another lock mode that conflicts with
> > any lock that would conflict with either of the two operand lock modes.

> That's commutative, as this is basically looking at the conflict table
> to get the union of the bits to indicate what are all the locks
> conflicting with lock A and lock B, and then we select the lock on the
> table that includes the whole union, with a minimum number of them.

Yes.

> Now, let's take for example this case with locks A, B, C, D:
> - Lock A conflicts with ACD
> - B with BCD
> - C with itself
> - D with itself
> What would you choose as a result of add(C,D)? A or B? Or the super
> lock conflicting with all of them?

This appears to me an hypothetical case that I don't think occurs in our
conflicts table, so I wouldn't worry about it.

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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: track_commit_timestamp and COMMIT PREPARED
Next
From: Robert Haas
Date:
Subject: Re: Reduce ProcArrayLock contention