Alvaro Herrera escribió:
> I think this is doable. We would need to add a phase 0 to ALTER TABLE
> processing, which grabs a less strong (than AccessExclusive) lock on the
> table, then goes over the list of commands and determine if at least one
> of them requires exclusive access to the table (I think the criteria
> here is whether table rewriting is needed, in which case AccessExclusive
> is enough). If none of them does, then we press on.
As expected, this idea didn't fly very far. The first problem I find
is that DefineIndex grabs a new lock by itself; if it's not a concurrent
build, it grabs ShareLock which immediately locks out ANALYZE.
It is worse than it sounds at first, because as soon as we are starting
ALTER TABLE with a less strong lock, then this ShareLock is deemed a
lock upgrade, with the ensuing dangers for deadlocks.
I'm starting to find this area of lock strength reduction a minefield,
one on which it is very easy to step on a mine.
So I'm back to considering a solution along the lines of cancelling a
running autovacuum job. But I think I would do it only for ANALYZE, not
Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 18.1", W 73º 13' 56.4"
"La espina, desde que nace, ya pincha" (Proverbio africano)
In response to
pgsql-hackers by date
|Next:||From: Andrew Dunstan||Date: 2007-10-03 17:18:35|
|Subject: Re: ECPG regression tests|
|Previous:||From: Alvaro Herrera||Date: 2007-10-03 14:02:28|
|Subject: Re: First steps with 8.3 and autovacuum launcher|