can't figure out why the following locking scenario works the way it
does:
spid 1:
start transaction
select a row from table T1 with updlock
result: see an Update lock for the row and index key
spid 2:
query for the same row as in session 1
result: the query succeeds
spid 3:
do same as spid 1
result: blocks trying to get Update lock on the index key for row
Now I do the query again in spid 2 and it blocks trying to get a Shared
lock on the index key, and it's waiting for spid3. why was it able to
get a shared lock on a index key that had an Update lock at first but
then can't get the same shared lock when somebody else is also trying
to get an update lock?
does:
spid 1:
start transaction
select a row from table T1 with updlock
result: see an Update lock for the row and index key
spid 2:
query for the same row as in session 1
result: the query succeeds
spid 3:
do same as spid 1
result: blocks trying to get Update lock on the index key for row
Now I do the query again in spid 2 and it blocks trying to get a Shared
lock on the index key, and it's waiting for spid3. why was it able to
get a shared lock on a index key that had an Update lock at first but
then can't get the same shared lock when somebody else is also trying
to get an update lock?
Comment