From: | Andrew - Supernews <andrew+nonews(at)supernews(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | swapping relfilenodes (was: Re: locks in CREATE TRIGGER, ADD FK) |
Date: | 2005-03-23 04:28:57 |
Message-ID: | slrnd41s49.2a3u.andrew+nonews@trinity.supernews.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2005-03-23, Neil Conway <neilc(at)samurai(dot)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 same transaction, 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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2005-03-23 04:33:02 | Re: locks in CREATE TRIGGER, ADD FK |
Previous Message | Neil Conway | 2005-03-23 04:26:37 | Re: locks in CREATE TRIGGER, ADD FK |