swapping relfilenodes (was: Re: locks in CREATE TRIGGER, ADD FK)

Поиск
Список
Период
Сортировка
От Andrew - Supernews
Тема swapping relfilenodes (was: Re: locks in CREATE TRIGGER, ADD FK)
Дата
Msg-id slrnd41s49.2a3u.andrew+nonews@trinity.supernews.net
обсуждение исходный текст
Ответ на locks in CREATE TRIGGER, ADD FK  (Neil Conway <neilc@samurai.com>)
Ответы Re: swapping relfilenodes (was: Re: locks in CREATE TRIGGER,  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
On 2005-03-23, Neil Conway <neilc@samurai.com> wrote:
> - swap the relfilenodes of the old and temporary heap relations

While discussing this one further on IRC, I noticed the following:

Everywhere I could find that currently replaces the relfilenode of a
relation does so while holding an AccessExclusive lock, and assumes that
this is sufficient to ensure that the old relfilenode can be killed when
the transaction commits. This is not correct.

Example:
 - backend A begins a serializable transaction - backend B truncates a table (and commits) - backend A, still in the
sametransaction, accesses the truncated table
 

Currently backend A sees the truncated table as empty, which is obviously
not right. This is obviously related to any attempt to weaken the locking
on other operations that modify relfilenodes, because doing it right implies
a mechanism to defer the removals past the commit of the modifying
transaction and up to the point where the old data can no longer be seen by
a live transaction.

-- 
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services


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

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: locks in CREATE TRIGGER, ADD FK
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: locks in CREATE TRIGGER, ADD FK