On 27.01.2011 20:44, Julian Foad wrote:
> My thinking was that if I don't have a lock, I can't safely add a
> reference because another process might delete the text just before I
> get around to executing that statement. But in fact I don't necessarily
> need a WC lock, I need *either* a WC lock *or* a SQL txn. And within
> that lock or txn I need to check the pristine text exists in the store
> before I add the reference.
>
> To remove a reference, I can't think why I should need a lock or a txn.
Can't be that simple. Every change to the database happens within a
transaction, every transaction can be rolled back in the event of any
kind of error. Consequently, you can only remove a reference (decrease a
reference counter) in such a way that rolling back the transaction in
which that happens can never leave a dangling reference to a deleted
pristine text.
In other words, deleting a pristine text requires an exclusive lock on
the database -- it is a write operation that affects database consistency.
-- Brane
Received on 2011-01-28 01:07:27 CET