开发者

IS (Intentional Shared) lock

开发者 https://www.devze.com 2022-12-12 16:40 出处:网络
Can anyone give a simple example of 开发者_开发问答a DB transaction using an Intentional Shared lock?If so, one using an intentional exclusive lock.Intent locks are needed because the lock manager doe

Can anyone give a simple example of 开发者_开发问答a DB transaction using an Intentional Shared lock? If so, one using an intentional exclusive lock.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消