Skip site navigation (1) Skip section navigation (2)

Re: ALTER TABLE SET STATISTICS requires AccessExclusiveLock

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE SET STATISTICS requires AccessExclusiveLock
Date: 2010-07-28 15:19:59
Message-ID: 1280330399.1878.5968.camel@ebony (view raw or flat)
Thread:
Lists: pgsql-hackers
On Wed, 2010-07-28 at 15:24 +0300, Peter Eisentraut wrote:
> On tor, 2010-07-15 at 10:24 +0100, Simon Riggs wrote:
> > Patch to reduce lock levels for 
> >  ALTER TABLE
> >  CREATE TRIGGER
> >  CREATE RULE
> 
> Tried this out, but $subject is still the case.  The problem is that
> ATRewriteCatalogs() calls AlterTableCreateToastTable() based on what it
> thinks the subcommands are, and AlterTableCreateToastTable() takes an
> AccessExclusiveLock.
> 
> This could possibly be addressed by moving AT_SetStatistics to
> AT_PASS_MISC in order to avoid the TOAST table call.
> 
> In a related matter, assigning ShareUpdateExclusiveLock to AT_SetStorage
> doesn't work either, because the TOAST table call needs to be done in
> that case.
> 
> Perhaps this logic needs to be refactored a bit more so that there
> aren't any inconsistencies between the lock modes and the "passes",
> which could lead to false expectations and deadlocks.

Changes as suggested, plus tests to confirm lock levels for
ShareUpdateExclusiveLock changes. Will commit soon, if no objection.

-- 
 Simon Riggs           www.2ndQuadrant.com
 PostgreSQL Development, 24x7 Support, Training and Services

Attachment: ddl_lock_tests.patch
Description: text/x-patch (9.9 KB)

In response to

pgsql-hackers by date

Next:From: Boxuan ZhaiDate: 2010-07-28 15:51:38
Subject: Re: merge command - GSoC progress
Previous:From: Joshua D. DrakeDate: 2010-07-28 14:57:22
Subject: Re: Toward a column reorder solution

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group