Ghost update in concurrent transaction

From: Sudin <sudinkc_at_yahoo.com>
Date: 29 Aug 2004 11:14:56 -0700
Message-ID: <1dcfba52.0408291014.303025b_at_posting.google.com>



Hello can anyone explain what ghost update does in a concurrent transaction? What I haven't understood is suppose an integrity constraint exists which says x+y+z = 1000 and concurrent transaction table below:
Transaction1                  Transaction2
bot
r1(x)
                              bot
                              r2(y)
r1(y)
                              y = y - 100
                              r2(z)
                              z = z + 100
                              w2(y)
                              w2(z)
                              commit

r1(z)
s = x+y+z
commit

The textbook explains this as to what Ghost update is: Transaction2 doesn't violate integrity constraint whereas the Transaction1 (variable s) becomes 1100 ?? and then transaction1 observes only "some" of the effects of Transaction2 & thus has a state the doesn't satisfy integrity constraint. And that is Ghost Update.

Now what i partly understand in the above transaction as:

1.  t1 starts with read x 
2.  t2 starts with read y
3.  t1 reads y
4.  t2 decreases y by 100
5.  t2 reads z 
6.  t2 increases z by 100
7.  t2 writes y & z
8.  t2 commit ( so this means y,z values are already written to the
disk?
               and Transaction2 ends??)

9. t1 reads z which has been increased by 100 (z+100) 10. t1 assigns s = x+y+ (z+100)
11. t1 ends with commit.

So now Ghost update exist because of the written value of z (i.e z+100) & the integrity constraint between them but isn't that what is to be assumed in a transaction ( one transaction reads, writes, commits & the other transactions reads its value from the disk??? ) Is this a ghost update because of the integrity constraint that says the total must be 1000?
I would appreciate ur help. :)
cheers
Sudin. Received on Sun Aug 29 2004 - 20:14:56 CEST

Original text of this message