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

Re: Problem with 2 avcuums in parallel

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Denis Perchine <dyp(at)perchine(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Problem with 2 avcuums in parallel
Date: 2000-11-03 17:12:39
Message-ID: 7031.973271559@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
I wrote:
> Denis Perchine <dyp(at)perchine(dot)com> writes:
>> When I run 2 vacuum's in parallel they hangs. Both.
>> I use PostgreSQL from 7.0.x CVS (almost 7.0.3).

> Hm.  I don't see a hang, but I do see errors like

> NOTICE:  Deadlock detected -- See the lock(l) manual page for a possible cause.
> ERROR:  WaitOnLock: error on wakeup - Aborting this transaction

> What's curious is that neither 7.0.2 nor current seem to exhibit this
> behavior (at least, it's much easier to reproduce in REL7_0_PATCHES than
> in 7.0.2 or current).

I'm not sure why it seemed easier to reproduce this deadlock in 7.0.3;
might just be because I was using a different test database for each
version.  Anyway, this turns out to be a long-standing issue.

The problem is that VACUUM does index_open() on each index of the target
relation.  That may require reading both pg_am and pg_amop to fill in
all the index-strategy data.  Guess what happens when you're vacuuming
pg_am itself, and someone else is vacuuming pg_amop.  (pg_amproc is a
possible source of deadlock here, too.)

This might be fixable with sufficient contortions, but I think we have
more important problems to worry about than whether concurrent VACUUMs
will occasionally deadlock.  It's not really easy to fix, in any case,
since we certainly want to grab exclusive lock on the target relation
before we start to investigate its indexes.  Else the indexes could
change/disappear under us :-(

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Igor KhanjineDate: 2000-11-03 17:25:58
Subject: Re[2]: DateTime functions
Previous:From: Tom LaneDate: 2000-11-03 16:59:49
Subject: Re: AW: AW: LIMIT in DECLARE CURSOR: request for comments

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