Re: Autovacuum improvements

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Autovacuum improvements
Дата
Msg-id 20070115145652.GM7233@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: Autovacuum improvements  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Autovacuum improvements  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:

> The DROP is at risk, but CREATE is also at risk because autovac feels
> free to connect to template0.  (One of the reasons we invented template0
> was to prevent CREATE DATABASE failures due to someone-else-connected,
> but autovac has broken that idea.)

ALTER DATABASE RENAME also needs the same treatment.

> Possibly we could handle these by extending create/drop db to check
> whether a process-connected-to-the-target-db is an autovac, and if so
> send it a SIGINT and wait for the process to terminate, instead of
> failing.

I'm cooking a patch for this which seems pretty reasonable, but I'm
having a problem: what mechanism do we have for waiting until a process
exits?  Maybe make autovacuum acquire an LWLock at start, which it then
keeps until it's gone, but it seems wasteful to have a lwlock just for
that purpose.

Another idea is to do kill(0, AutoVacPID); sleep(); in a loop, but that
seems pretty stupid.

Better ideas anyone?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: xml type and encodings
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: -f option for pg_dumpall