From: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
---|---|
To: | Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov> |
Cc: | Simon Riggs <simon(at)2ndQuadrant(dot)com>, Dan Ports <drkp(at)csail(dot)mit(dot)edu>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: SIREAD lock versus ACCESS EXCLUSIVE lock |
Date: | 2011-05-06 11:11:29 |
Message-ID: | 4DC3D761.8030305@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 30.04.2011 01:04, Kevin Grittner wrote:
> TRUNCATE TABLE and DROP TABLE should generate a rw-conflict *in* to
> the enclosing transaction (if it is serializable) from all
> transactions holding predicate locks on the table or its indexes.
> Note that this could cause a transactions which is running one of
> these statements to roll back with a serialization error. This seems
> correct to me, since these operations essentially delete all rows.
> If you don't want the potential rollback, these operations should be
> run at another isolation level. The difference between these two
> statements is that I think that TRUNCATE TABLE should also move the
> existing predicate locks to relation locks on the table while DROP
> TABLE (for obvious reasons) should just delete the predicate locks.
Note that TRUNCATE has never been MVCC-safe anyway. Perhaps it's best to
just treat it like DROP TABLE. Or can we use the predicate lock
mechanism to abort serializable transactions that incorrectly see the
table as empty?
> DROP DATABASE should quietly clean up any predicate locks from
> committed transactions which haven't yet hit their cleanup point
> because of overlapping transactions in other databases.
This is just an optimization, right? The predicate locks will eventually
go away anyway.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2011-05-06 12:09:02 | Re: SIREAD lock versus ACCESS EXCLUSIVE lock |
Previous Message | Susanne Ebrecht | 2011-05-06 10:15:15 | Re: characters or bytes? |