consistent get 和DB block get的认识

Oracle accesses blocks in one of two modes, current or consistent.

A 'db block get' is a current mode get.  That is, it's the most up-to-date
copy of the data in that block, as it is right now, or currently.  There
can only be one current copy of a block in the buffer cache at any time.
Db block gets generally are used when DML changes data in the database.
In that case, row-level locks are implicitly taken on the updated rows.
There is also at least one well-known case where a select statement does
a db block get, and does not take a lock.  That is, when it does a full
table scan or fast full index scan, Oracle will read the segment header
in current mode (multiple times, the number varies based on Oracle version).

A 'consistent get' is when Oracle gets the data in a block which is consistent
with a given point in time, or SCN.  The consistent get is at the heart of
Oracle's read consistency mechanism.  When blocks are fetched in order to
satisfy a query result set, they are fetched in consistent mode.  If no
block in the buffer cache is consistent to the correct point in time, Oracle
will (attempt to) reconstruct that block using the information in the rollback
segments.  If it fails to do so, that's when a query errors out with the
much dreaded, much feared, and much misunderstood ORA-1555 "snapshot too old".

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21993926/viewspace-659692/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/21993926/viewspace-659692/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ConsistentHash是一种在分布式系统中解决数据分片、负载均衡的算法,用于解决数据分布和节点动态变化的问题。在Java中,可以通过实现ConsistentHash算法来分配数据并达到负载均衡的效果。 在Java中,可以使用TreeMap或者HashMap作为底层数据结构来实现ConsistentHash算法。TreeMap可以保证数据有序性,HashMap则可以提供更快的插入和查询速度。我们在这里以TreeMap为例来说明ConsistentHash的实现过程。 首先,我们需要创建一个哈希函数,将节点的IP地址或者ID映射为整数,作为节点的哈希值。然后,我们在TreeMap中存储节点的哈希值和对应的物理节点信息。 当有新的数据需要插入时,将数据的哈希值通过哈希函数计算得到对应的整数。然后,在TreeMap中找到大于等于该哈希值的最小键值对应的物理节点,将数据保存在该节点上。 当节点动态增加或删除时,我们需要重新计算所有已存在数据的哈希值,并将数据重新分配到新的节点上,以保持数据的均匀分布。 通过使用ConsistentHash算法,我们可以实现数据的分片存储和负载均衡,使得在节点动态变化的情况下,系统的性能和可扩展性得到有效的提升。 总之,ConsistentHash算法是一种在分布式系统中解决数据分片、负载均衡问题的算法。在Java中,我们可以通过实现ConsistentHash算法,使用TreeMap或者HashMap来实现数据分配和节点动态变化的管理。这样可以有效提高系统的性能和可扩展性。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值