Rac 的GES/GCS原理6(图文解释cache fusion机制4)

Example 4: Write-to-Read Transfer
The behavior of the write-to-read transfer is determined by the _FAIRNESS_THRESHOLD parameter,
which was introduced in Oracle 8.1.5 and defaults to 4. Prior to the introduction of this parameter,
when Instance A held a block in exclusive mode and Instance B requested a read-only copy of that
block, Instance A would downgrade its exclusive lock to a shared lock and send the block to Instance B,which would also set a shared lock on the block.
例子4:读写传输
读写传输的表现要根据_FAIRNESS_THREASHOLD参数,这个参数从ORACLE 8.1.5 出现,而且
默认取值为4。在引进这个参数之前,当实例A对这个数据块以排他模式持有,而实例B要求
这个数据块的只读拷贝,此时实例1将降级排他锁为共享锁模式--并把数据块发送给实例B,
而实例B将对数据块加一个共享锁。

 However, if Instance A is performing frequent updates on the block, it will need to reacquire the block and set an exclusive lock again. If this process is repeated frequently, then Instance A will be continually interrupted, as it has to downgrade the exclusive lock to a shared lock and wait until Instance B has finished reading the block before it can convert the shared lock back into an exclusive lock.
然而,如果实例A在频繁的对这个数据块做跟新操作,它将需要重新获取这个数据块,并
再次设置专有共享锁,所以他必须降级转有锁到共享模式,等待实例B,直到实例B完成了
对数据块的读操作,再把数据共享锁转换回转有锁模式。


The _FAIRNESS_THRESHOLD parameter modifies this behavior. When this parameter is set,
Instance A will no longer downgrade the exclusive lock. Instead, it sends a null lock to Instance B,
and then it can continue processing. However, if instance B requests the block _FAIRNESS_THRESHOLD
times, by default 4, then Instance A will revert to the original behavior—it will downgrade the
exclusive lock to a shared lock and ship the block to Instance B, which will also set a shared lock on
the block.


而_FAIRNESS_THREASHOLD参数修改这个现象,当这个参数被设置之后,还是上面的例子,
实例将不再降级本地的专有锁。取而代之,它将发送一个空锁给实例B,然后实例A将继续做
处理操作。然而,如果实例B要求这个数据块的次数达到了_FAIRNESS_THREAHOLD次数之后,
默认是4次,实例A将改变原来的做法---它将降级专有锁到共享模式,然后把数据块传输到实例
B,实例B也会对这个数据块设置一个共享锁。

This behavior is explained in the following example.
Instance 2 requests a current read on the block. Instance 2 is not aware that the block is currently
held by Instance 4. Instance 2 identifies that Instance 3 is the resource master instance for the block
and sends amessage to Instance 3 requesting shared access to the block (Figure 22-14).


这个表现是以下面的例子来解释的:
实例2需要对这个数据块做一个当前读。实例2并不知道这个数据块被实例4锁持有。实例2发现实例
3是数据块的资源属主,于是发送消息给实例3,要求对这个数据块做一个共享访问。


Instance 3 checks in the GRD and discovers that the block is currently held by Instance 4 for
exclusive (update) access. Instance 3 sends a message to Instance 4 requesting that it send the block
to Instance 2 in shared mode (Figure 22-15).
实例三检查GRD,发现数据块正在被实例4以专有锁持有。实例3发送一个消息给实例4,要求
实例4 以共享模式传输数据块给实例2。


Instance 4 sends the block to Instance 2 (Figure 22-16). Because the block has been requested
less than _FAIRNESS_THRESHOLD times, Instance 4 retains the exclusive lock, and Instance 2 receives
a null lock.

实例4将传输这个数据块给实例2,。因为这个数据快被要求的次数少于_FAIRNESS_THRESHOLD
的次数,实例4将保留exclusive锁模式,而实例2将收到一个空锁。

 

 

 

Instance 2 receives the block and sends a message to Instance 3 to update the resource status
(Figure 22-17). Instance 3 updates the GRD. Instance 2 assumes a null lock on the block and reads it.
Instance 4 can update the block for which it continues to hold an exclusive process.

实例2收到了这个数据块,并发送信息到实例3来更新资源状态。实例3将跟新GRD。实例2
对这个数据块申明一个空锁并读取它。同时,实例4能够跟新这个数据块,因为它还持有这
个数据块的专有锁。

 

 

 

 

The preceding process can be repeated the number of times specified by the
_FAIRNESS_THRESHOLD parameter. By default, the value of this parameter is 4.
Instance 2 has now flushed the block from its buffer cache and needs to read it again. It sends
a read request to the resource master, which is Instance 3 (Figure 22-18).
上面的过程可以重复多次,具体次数由参数_FAIRNESS_THRESHOLD决定。
这个参数的默认值是4。实例2现在已经把数据块从buffer cache 清除了,又需要
再读取这个数据块。它这时又把要求发送给资源属主,属主是实例3

Instance 3 (the resource master) sends a message to Instance 4 requesting that it send a copy
of the block to Instance 2 (Figure 22-19). Instance 4 notes that it has already sent the block
_FAIRNESS_THRESHOLD times to Instance 2.

实例3(资源属主)发送消息给实例4,要求它发送数据块的拷贝给实例2,。实例4发现,
自己已经发送_FAIRNESS_THRESHOLD 次信息给实例2了。

 

 

 

Instance 4, therefore, downgrades the exclusive lock to a shared lock and sends the block to
Instance 2 (Figure 22-20).

因此,实例4降级本地对这个数据块的专有锁到共享锁模式,并把数据块发送给实例2
Instance 2 receives the block, assumes a shared lock, and sends amessage to Instance 3 to
update the resource status, setting the lock mode on the block to shared (Figure 22-21). Instance 3
updates the GRD。

实例2收到这个数据块,并宣称一个共享锁,并把资源信息发送给实例3来跟新资源状态,
设置该数据块的锁模式为共享。实例三跟新相关的GRD信息。

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值