/** Buffer block for which an uncompressed page exists */
typedef    struct buf_block_struct        buf_block_t;

/** The buffer control block structure */

struct buf_block_struct{

    /** @name General fields */
    /* @{ */

    buf_page_t    page;   //详见/*!< page information; this must
                    be the first field, so that
                    buf_pool->page_hash can point
                    to buf_page_t or buf_block_t */
    byte*        frame;        /*!< pointer to buffer frame which
                    is of size UNIV_PAGE_SIZE, and
                    aligned to an address divisible by
                    UNIV_PAGE_SIZE */
#ifndef UNIV_HOTBACKUP
    UT_LIST_NODE_T(buf_block_t) unzip_LRU;
                    /*!< node of the decompressed LRU list;
                    a block is in the unzip_LRU list
                    if page.state == BUF_BLOCK_FILE_PAGE
                    and page.zip.data != NULL */
#ifdef UNIV_DEBUG
    ibool        in_unzip_LRU_list;/*!< TRUE if the page is in the
                    decompressed LRU list;
                    used in debugging */
#endif /* UNIV_DEBUG */
    mutex_t        mutex;        /*!< mutex protecting this block:
                    state (also protected by the buffer
                    pool mutex), io_fix, buf_fix_count,
                    and accessed; we introduce this new
                    mutex in InnoDB-5.1 to relieve
                    contention on the buffer pool mutex */
    rw_lock_t    lock;        /*!< read-write lock of the buffer
                    frame */
    unsigned    lock_hash_val:;/*!< hashed value of the page address
                    in the record lock hash table;
                    protected by buf_block_t::lock
                    (or buf_block_t::mutex, buf_pool->mutex
                        in buf_page_get_gen(),
                    buf_page_init_for_read()
                    and buf_page_create()) */
    ibool        check_index_page_at_flush;
                    /*!< TRUE if we know that this is
                    an index page, and want the database
                    to check its consistency before flush;
                    note that there may be pages in the
                    buffer pool which are index pages,
                    but this flag is not set because
                    we do not keep track of all pages;
                    NOT protected by any mutex */
    /* @} */
    /** @name Optimistic search field */
    /* @{ */

    ib_uint64_t    modify_clock;    /*!< this clock is incremented every
                    time a pointer to a record on the
                    page may become obsolete; this is
                    used in the optimistic cursor
                    positioning: if the modify clock has
                    not changed, we know that the pointer
                    is still valid; this field may be
                    changed if the thread (1) owns the
                    pool mutex and the page is not
                    bufferfixed, or (2) the thread has an
                    x-latch on the block */
    /* @} */
    /** @name Hash search fields (unprotected)
    NOTE that these fields are NOT protected by any semaphore! */
    /* @{ */

    ulint        n_hash_helps;    /*!< counter which controls building
                    of a new hash index for the page */
    ulint        n_fields;    /*!< recommended prefix length for hash
                    search: number of full fields */
    ulint        n_bytes;    /*!< recommended prefix: number of bytes
                    in an incomplete field */
    ibool        left_side;    /*!< TRUE or FALSE, depending on
                    whether the leftmost record of several
                    records with the same prefix should be
                    indexed in the hash index */
    /* @} */

    /** @name Hash search fields
    These 5 fields may only be modified when we have
    an x-latch on btr_search_latch AND
    - we are holding an s-latch or x-latch on buf_block_struct::lock or
    - we know that buf_block_struct::buf_fix_count == 0.

    An exception to this is when we init or create a page
    in the buffer pool in buf0buf.c.

    Another exception is that assigning block->index = NULL
    is allowed whenever holding an x-latch on btr_search_latch. */

    /* @{ */

#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
    ulint        n_pointers;    /*!< used in debugging: the number of
                    pointers in the adaptive hash index
                    pointing to this frame */
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
    unsigned    curr_n_fields:;/*!< prefix length for hash indexing:
                    number of full fields */
    unsigned    curr_n_bytes:;/*!< number of bytes in hash
                    indexing */
    unsigned    curr_left_side:;/*!< TRUE or FALSE in hash indexing */
    dict_index_t*    index;        /*!< Index for which the
                    adaptive hash index has been
                    created, or NULL if the page
                    does not exist in the
                    index. Note that it does not
                    guarantee that the index is
                    complete, though: there may
                    have been hash collisions,
                    record deletions, etc. */
    /* @} */
# ifdef UNIV_SYNC_DEBUG
    /** @name Debug fields */
    /* @{ */
    rw_lock_t    debug_latch;    /*!< in the debug version, each thread
                    which bufferfixes the block acquires
                    an s-latch here; so we can use the
                    debug utilities in sync0rw */
    /* @} */
# endif
#endif /* !UNIV_HOTBACKUP */
};

结构体buf_block_t的更多相关文章

  1. Go结构体实现类似成员函数机制

    Go语言结构体成员能否是函数,从而实现类似类的成员函数的机制呢?答案是肯定的. package main import "fmt" type stru struct { testf ...

  2. C#基础回顾(二)—页面值传递、重载与重写、类与结构体、装箱与拆箱

    一.前言 -孤独的路上有梦想作伴,乘风破浪- 二.页面值传递 (1)C#各页面之间可以进行数据的交换和传递,页面之间可根据获取的数据,进行各自的操作(跳转.计算等操作).为了实现多种方式的数据传递,C ...

  3. go语言结构体

    定义: 是一种聚合的数据类型,是由零个或多个任意类型的值聚合成的实体. 成员: 每个值称为结构体的成员. 示例: 用结构体的经典案例处理公司的员工信息,每个员工信息包含一个唯一的员工编号.员工的名字. ...

  4. C语言中的结构体

    用户自己建立自己的结构体类型 1.  定义和使用结构体变量 (1).结构体的定义 C语言允许用户自己建立由不同类型数据组成的组合型的数据结构,它称为结构体. (2).声明一个结构体类型的一般形式为: ...

  5. C++_系列自学课程_第_12_课_结构体

    #include <iostream> #include <string> using namespace std; struct CDAccount { double bal ...

  6. java socket传送一个结构体给用C++编写的服务器解析的问题

    另一端是Java写客户端程序,两者之间需要通信.c++/c接收和发送的都是结构体,而Java是直接发送的字节流或者byte 数组.解决方法:c++/c socket 在发送结构体的时候其实发送的也是字 ...

  7. swift学习笔记3——类、结构体、枚举

    之前学习swift时的个人笔记,根据github:the-swift-programming-language-in-chinese学习.总结,将重要的内容提取,加以理解后整理为学习笔记,方便以后查询 ...

  8. HDOJ 1009. Fat Mouse' Trade 贪心 结构体排序

    FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  9. C语言结构体对齐

    1.结构体变量中的元素如何访问? (1)数组中元素的访问方式:表面上有2种方式(数组下标方式和指针方式):实质上都是指针方式访问.(2)结构体变量中的元素访问方式:只有一种,用.或者->的方式来 ...

随机推荐

  1. 几个好用的截取字符串的php函数分享

    分享几个好用的PHP 截取字符串函数(支持gb2312和utf-8). 1.截取GB2312字符用的函数 <?php /** **截取中文字符串 * edit by www.jbxue.com ...

  2. CCNP第一天 Rip综合实验

    实验题如图所示 R2--R6之间是RipV2, R7和R8是RipV1, 除了R2到R6是快速以太网线,其他均为串线. 所用的拓扑图为CCNP标准版拓扑 如下: ------------------- ...

  3. 手把手教你写LKM rookit! 之 第一个lkm程序及模块隐藏(一)

    唉,一开始在纠结起个什么名字,感觉名字常常的很装逼,于是起了个这<手把手教你写LKM rookit> 我觉得: 你们觉得:...... 开始之前,我们先来理解一句话:一切的操作都是系统调用 ...

  4. ASP.NET中POST数据并跳转页面

    需求:先Post提交数据,然后跳转到目标页面 找了好久才发现这个神奇的类HttpHelper.原理很简单,利用html的from表单拼接,然后执行 使用方法: NameValueCollection ...

  5. DB天气app冲刺第九天

    今天已经是冲刺的第九天了.应该算是进入了冲刺的后半期了.今天的android界面UI设计基本完成了.但还是有一些的bug,自己怎么也调不好,明天需要请教一下大神去. 今天已经把昨天布置的任务完成了.昨 ...

  6. GitHub 有哪些优秀的项目

    GitHub 有哪些优秀的项目 http://www.zhihu.com/question/20584141

  7. c++ 异常处理 assert | try

    #include <iostream> #include <cassert> using namespace std; int main() { ; assert(i == ) ...

  8. Extjs布局——layout: 'card'

    先看下此布局的特性: 下面演示一个使用layout: 'card'布局的示例(从API copy过来的)——导航面板(注:导航面板切换下一个或上一个面板实际是导航面板的布局--layout调用指定的方 ...

  9. Hibernate简介2

    一.主配置 ◆查询缓存,同下面讲的缓存不太一样,它是针对HQL语句的缓存,即完全一样的语句再次执行时可以利用缓存数据.但是,查询缓存在一个交易系统(数据变更频繁,查询条件相同的机率并不大)中可能会起反 ...

  10. 谈谈怎么实现Oracle数据库分区表

    谈谈怎么实现Oracle数据库分区表 数据库的读写分离 SQLSERVER性能监控级别步骤 Oracle索引问题诊断与优化(1)