Re: tablecmds.c and lock hierarchy

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tablecmds.c and lock hierarchy
Date: 2015-08-05 00:51:30
Message-ID: CAB7nPqTtP8dNhcHtfY+d23GNgV-X7eg7=XcgZVRU4iQA0cRKjQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 5, 2015 at 3:05 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Tue, Aug 4, 2015 at 2:41 AM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> Yep, true as things stand now. But this would get broken if we add a
>> new lock level between ShareRowExclusiveLock and AccessExclusiveLock
>> that does not respect the current monotone hierarchy between those.
>
> But we're probably not going to do that, so it doesn't matter; and if
> we do do it, we can worry about it then. I don't think this is worth
> getting concerned about now.

OK. Then let me suggest the attached Assert safeguard then. It ensures
that all the locks used follow a monotony hierarchy per definition of
what is on the conflict table. That looks like a cheap insurance...

In any case, this means as well that we should move on with the
current logic presented by Fabrizio on the other thread.
--
Michael

Attachment Content-Type Size
20150805_tablecmds_lock_assert.patch text/x-diff 663 bytes

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2015-08-05 00:51:43 Re: WIP: Make timestamptz_out less slow.
Previous Message Amit Langote 2015-08-05 00:50:47 Re: Transactions involving multiple postgres foreign servers