Re: Q about overlapping transactions...
Date: 28 Aug 2001 11:51:12 GMT
Message-ID: <9mg0jg$8m7$1_at_news.tue.nl>
Chris Quinn wrote:
>
> I would like to ask instead about the case of two data items that
> need to be altered in tandem - access to either of them before both
> are updated is an inconsistency.
>
> Serializability theory discusses various ways of scheduling
> concurrent transactions and in the case of incremental release of
> locks I am wondering how the dependency between the above mentioned
> data items is preserved if another transaction comes along and tries
> to read them. How is this transaction (T2) prevented from reading one
> item updated by T1 before T1 updates the other?
That is a real problem if you have explicit unlocking, even under two-phase locking. You could have for example the following sequence of events:
T1 T2
- ------------- BEGIN TRANS. read-lock(r1) read(r1) read-lock(r2) read(r2) wite-lock(r1) write(r1) wite-lock(r2) write(r2) unlock(r1) BEGIN TRANS. read-lock(r1) read(r1) write-lock(r1) write(r1) unlock(r1) COMMIT ROLLBACK
-- Jan HiddersReceived on Tue Aug 28 2001 - 13:51:12 CEST