Re: Why does VACUUM FULL bother locking pages?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Why does VACUUM FULL bother locking pages?
Дата
Msg-id 200.1127409304@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Why does VACUUM FULL bother locking pages?  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Looking again, PageRepairFragmentation is called on a copy of the page,
> not on the page itself, so this is not a problem.  The page is only
> modified to exchange old Xids for FrozenTransactionId, or to set some
> hint bits, so this really shouldn't be too much of a problem.  I still
> think it would be better to lock the page beforehand.

Actually, the case that's a bit worrisome is the PageIsNew path: it'd be
possible for a partially-valid page header to be written out.  This
wouldn't result in data loss, exactly, since there's nothing on the page
... but we might have a problem using the page later.

The FrozenTransactionId update case is already presumed to be atomic by
vacuumlazy.c, so I don't feel too bad about it, but it surely needs a
comment at least.

On the whole it seems like we might as well just take the exclusive
buffer lock and not try to be cute.

AFAICT the other routines in vacuum.c all do proper locking when they
are modifying pages, so it's just this one place that is taking a short
cut.
        regards, tom lane


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

Предыдущее
От: Thomas Hallgren
Дата:
Сообщение: Re: What has happened to pgxs?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Hierarchical Queries--Stalled No Longer...