4.7 Lock structure

 < Day Day Up > 



In the above section we stated that when a block held by an instance is requested by another instance, the original holder makes a copy of the block which becomes the past (previous) image of the block. To keep track of these PIs, Oracle uses locking of blocks. Implementing roles and modes enforce these locks. Refer to Tables 4.1 and 4.2 for an explanation of the roles and modes.

When a lock is acquired for the first time by an instance, only that specific instance has a copy of the block. Therefore, the block is acquired with a local role. If the block was acquired from a remote instance, the holding instance will make a copy of the original block before transmitting the block to the requesting instance. This is called the past image. This indicates that there are two possibilities; one where a PI is maintained and the second where a PI is not maintained. These possibilities for the PI are represented by a Boolean value of ''yes'' or ''no.'' These modes, roles, and instance of the PI all represent the lock structure.

Figure 4.6 represents the three-character lock structure where:


Figure 4.6: GCS lock structure.

  • The first character ''M'' indicates the mode:

    N for null

    S for shared

    X for exclusive

  • The second character ''R'' indicates the role:

    L for local

    G for global

  • The third character ''n'' indicates whether the GRD knows about the PI:

    0for no

    1 for yes

Putting these together there are potentially nine types of lock situations.

Table 4.3 lists the various lock modes and their descriptions.

Table 4.3: Lock Modes

Chars

Mode

Description

NL0

Null local 0

Essentially the same as N with no past image

SL0

Shared local 0

Essentially the same as S with no past images

XL0

Exclusive local 0

Essentially the same as X with no past images

NG0

Null global 0

Global N lock and the instance owns a current block image

SG0

Shared global 0

Global S lock with no past images

XG0

Exclusive global 0

Global X lock with ownership to the block

NG1

Null global 1

Global N lock with the instance past image.

SG1

Shared global 1

Global S lock, with instance owning past image

XG1

Exclusive global 1

Global X lock, and instance owns a past image

Blocks held by a single instance only have a single copy and each is in control of its modification and writing of the changes to disk. However, when another instance requests for the same block, its status changes from a local to a global state. Only in this situation, where one or more other instances also contains a copy of the current block, does the original instance require to keep the original, or PI, of the block.



 < Day Day Up > 



Oracle Real Application Clusters
Oracle Real Application Clusters
ISBN: 1555582885
EAN: 2147483647
Year: 2004
Pages: 174

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net