Hi, can anyone give a simple example of a db transaction using an Intentional Shared lock, and (if can) one using an intentional exclusive lock.
I'm studying them and trying to understand.
Thanks
Hi, can anyone give a simple example of a db transaction using an Intentional Shared lock, and (if can) one using an intentional exclusive lock.
I'm studying them and trying to understand.
Thanks
Intent locks are needed because the lock manager does not understand the physical structure of the entities locked. If one transaction S-locks a record, say R1, and another transaction asks for an X-lock on a page, say P1, what happens if R1 is actually located on P1? the lock manager should not honor the P1 request until R1 is released, but to do so it would have to understand that R1 is contained in P1.
Since the lock manager clearly cannot know the structural details of the objects locked, the intent lock were introduced. The first transaction will place an IS-lock on P1 then an S-lock on R1. When the second transaction requests for X-lock on P1, it will conflict with the IS-lock placed by the first transaction.