Re: Why does VACUUM FULL bother locking pages?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Why does VACUUM FULL bother locking pages?
Дата
Msg-id 4897.1126933164@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Why does VACUUM FULL bother locking pages?  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> So, the only callers of both has already acquired appropiate locks at
> the relation level -- nobody is going to be modifying the blocks while
> they proceed.  So why bother locking the pages at all?  Is there a
> reason or is this an historical accident?

No, because operations such as checkpointing and bgwriter will feel free
to write out pages that aren't exclusive-locked; they don't try to get
a lock at the table level.  Failing to lock the buffer would risk
allowing an invalid page state to be written to disk --- which, if we
then crashed before writing the WAL record for the vacuum operation,
would represent unrecoverable corruption.
        regards, tom lane


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

Предыдущее
От: Gavin Sherry
Дата:
Сообщение: Re: Spinlocks, yet again: analysis and proposed patches
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Spinlocks, yet again: analysis and proposed patches