Re: First steps with 8.3 and autovacuum launcher

Alvaro Herrera <alvherre@commandprompt.com>

From: Alvaro Herrera <alvherre@commandprompt.com>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Gregory Stark <stark@enterprisedb.com>, Guillaume Smet <guillaume.smet@gmail.com>, "Matthew T. O'Connor" <matthew@zeut.net>, Heikki Linnakangas <heikki@enterprisedb.com>, Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2007-10-04T21:33:42Z
Lists: pgsql-hackers

Attachments

Simon Riggs escribió:

> Seems like we don't need to mess with the deadlock checker itself.
> 
> We can rely on the process at the head of the lock wait queue to sort
> this out for us. So all we need do is look at the isAutovacuum flag on
> the process that is holding the lock we're waiting on. If it isn't an
> autoANALYZE we can carry on with the main deadlock check. We just need a
> new kind of deadlock state to handle this, then let ProcSleep send
> SIGINT to the autoANALYZE and then go back to sleep, waiting to be
> reawoken when the auotANALYZE aborts.

Ok, I think this makes sense.

I can offer the following patch -- it makes it possible to determine
whether an autovacuum process is doing analyze or not, by comparing the
PGPROC of the running WorkerInfo list (the list has at most
max_autovacuum_workers entries, so this is better than trolling
ProcGlobal).

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support