zoukankan      html  css  js  c++  java
  • DB2的日志理解难点

    在DB2中最早的recovery时间点,是由minBuffLsn 和 lowTranLsn 的最小值决定的。

    minBuffLsn: represents the oldest change to a page in the buffer pool that has not been written and persisted to disk yet.

    lowTranLsn: represents the oldest active uncommitted transaction (specifically the LSN of the first log record it wrote).

    在DB2和ORACLE数据库都还有一个约定,从buffer pool中写数据到磁盘之前其对应的redo log必须先从log buffer pool中写到磁盘中。

    注意:这里的log buffer pool中的redo log没有要求是已经committed的。

    所以,在数据库中,还没有被提交的数据被写到磁盘中是很正常的事情,只要这块数据所对应的redo log已经被写入到磁盘中,对于这个交易是否已经提交,不关紧要。

    那么在recovery的时候就会出现这样的情况:

    minBuffLsn < lowTranLsn : 有已经提交的交易(commit动作会触发数据库将对应的redo log写入到磁盘)数据还有没有被从buffer pool中写入到磁盘,所以recovery时从minBuffLsn对应的log开始,redo后面那些已经提交的或者未提交的交易,重建transaction table。

    lowTranLsn > minBuffLsn : 有还没有提交的交易(但是redo log是已经写入到磁盘中的)的数据已经被写入到磁盘中,所以recovery时将从lowTranLsn对应的log开始,这部分数据已经被写入到磁盘中的redo log只是读取一下,创建transaction table。

    这张图片做出了比较清晰的解释。

  • 相关阅读:
    iOS新建项目基础设置
    Burp安装及配置(修改参数测试)
    打开他人代码,如何运行起来
    四、python用户交互程序
    三、python_字符编码与二进制
    二、python_变量要求
    一、python_(入门)
    linux 常用命令之一
    Atcoder Regular Contest 093 C
    「HNOI2016」序列
  • 原文地址:https://www.cnblogs.com/jackhub/p/3219512.html
Copyright © 2011-2022 走看看