Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle RAC CacheFusion Series XVI: Oracle RAC CurrentBlock Server

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

There are two ways to store PCM lock resources, 1. If the PCM lock belongs to the local instance, it is stored in the LE structure of the local instance. two。 If the PCM lock belongs to the remote instance, it will be allocated and stored in the shared pool of the local instance.

Kclle structure:

Kcllerls stands for release

Kcllelnm stands for name (id1,id2)

Kcllemode stands for hold-mode

Kclleacq stands for acquiring

Kcllelck stands for DLM lock.

Kjbr structure:

Resname_kjbr [2] represents the resource name

Grant_q_kjbr stands for grant queue

Convert_q_kjbr stands for conversion queue

Mode_role_kjbr, which represents authorization modes and roles: NULL (0x00), S (0x01), X (0x02), L0 local (0x00), G0 global no PI (0x08), G1 global PI (0x018).

The field mode_role_kjbl in kjbl indicates the locking mode:

0x00 is represented as NULL mode

0x01 is represented as S mode

0x02 is expressed as X

0x04 means to open the lock for the master node

0x08 is represented as a global role

0x10 is expressed as the existence of PI

0x20 is expressed as a CR request

0x40 is represented as an S-mode request

0x80 is represented as an X-mode request.

Example

SELECT * FROM emp WHERE empno =...; UPDATE emp SET sal = sal + 10 WHERE empno =...; COMMIT; ALTER SYSTEM CHECKPOINT LOCAL;1

1. Lock and block request, remote master

two。 Lock and block requests, local master, shared mode

3. Lock conversion, lock degradation

4. Block fusion, write / write

5. Block fusion, write / read (CR)

6. Writing involves locking, discarding PI

7. Block fusion write / read, similar to step 5

Step 1

The initial table is not cached in any instance in the cluster, so master grants the SL0 schema to instance 3. 0. Example 3 then reads the block from disk into its buffer cache. View the resources that x$kjbr and x$kjbl have created and the local locks that have been acquired. A STATE of 2 means that the memory block is in shared mode scur.

Step 2

The master node grants the SL0 schema to instance 2 because:

There is a shared lock on the resource (owned by instance 3).

The same resource on the master node does not have a shared lock.

Example 2 then reads the block from disk to the local cache. If there is a shared lock on the master node or if _ cr_grant_local_role is TRUE (11g is AUTO), the behavior changes. In this case, the master instance forwards the CR request to the instance owner of the shared lock (instance 3) and sends the current buffer to instance 2.

Step 3

The requestor (instance 2) sends an X request to the master (itself).

Master (instance 2) sends the ping X message to the S lock holder (instance 3).

Example 3 transitions the buffer state from scur to CR and turns off locking.

Instance 3 sends the buffer to the requestor (instance 2).

The requester (instance 2) sends the ASSUME to the master (itself) to obtain the locking mode and notifies the previous holder of the master (instance 3) that the lock has been turned off.

X$BH.STATE displays 1, the current block (X CURRENT).

The X$KJBR.KJBRROLE displays 0, indicating that the lock owned by instance 2 is XL0, which means that the lock owned by instance 3 is closed.

X$BH.STATE changes from 2 to 3 (that is, S becomes CR).

Step 4

Requestor instance 1 performs an update to send an X request to the master instance (instance 2). The master instance (instance 2) sends ping X to the X lock holder (itself). Example 2 converts the buffer state from the local X CURRENT to PI. Example 2 sends the buffer block to the requestor (example 1).

The requestor (instance 1) sends an ASSUME to the master (instance 2) to obtain the locking mode and informs the primary instance that instance 1 has a global X lock and instance 2 has a global NULL lock.

X$BH.STATE switches from X to PI mode.

The KJBL.KJBLROLE value of 24 is 8 + 16, indicating PI and GLOBAL (that is, G1 mode).

X$BH.STATE is 1, which is currently exclusive.

Step 5

Instance 3 (requester) sends CRREQ (S) to the master (instance 2).

Select CR for master instance (instance 2), as shown below:

If the resource role is G0, the master instance uses the highest version of PI that exists on its own buffer cache

Otherwise, if the resource role is G1, the master instance selects the PI that is close to the SCN of the requested SCN in CRREQ.

If the resource role is XL0, the master instance selects the current cache of the instance.

The primary instance (instance 2) forwards the CRREQ to the selected instance (itself). The selected instance (instance 2) builds the CR buffer and sends it to instance 3, which does not require an DLM lock.

Step 6

Instance 1 (requester) sends a W request (from client to master) to master instance (instance 2).

Master (instance 2) registers the SCN of the block to be written (in the DLM resource) to hold the writes that are about to occur. Master does not authorize writes and sends a W request to instance 1 because instance 1 has the highest SCN (the current block).

Example 1 writes to the buffer by linking the buffer in the ping queue. DBWR performs writes.

Instance 1 sends a W notification to instance 2 (master).

Instance 1 (master) sets the resource to the local role and sends the FLUSH_PI to each instance that contains the PI (in this case, itself). The instance that receives this instance converts the PI buffer to a CR buffer and frees the associated LE.

X$BH.STATE changes from 8 to 3, that is, from the PI buffer to the CR buffer.

X$LE indicates that no LE lock holds the CR buffer.

The X$KJBL.KJBLROLE changes to 0, indicating that the lock is now local.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report