Re: tablecmds.c and lock hierarchy

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tablecmds.c and lock hierarchy
Date: 2015-08-04 17:23:20
Message-ID: 20150804172320.GS2441@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier wrote:
> On Tue, Aug 4, 2015 at 2:43 PM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-08-04 17:24:06 Re: Reduce ProcArrayLock contention
Previous Message Robert Haas 2015-08-04 17:20:55 Re: track_commit_timestamp and COMMIT PREPARED