/** 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. 前端encodeURIComponent 和后端http_build_query配合

    解决特殊字符不能转义 1.  function fixedEncodeURIComponent (str) {  return encodeURIComponent(str).replace(/[!' ...

  2. SqlServer中创建Oracle连接服务器

    转自太祖元年的:http://www.cnblogs.com/jirglt/archive/2012/06/10/2544025.html参考:http://down.51cto.com/data/9 ...

  3. 《WPF程序设计指南》读书笔记——第3章 内容的概念

    1.Content属性及字体相关的属性 using System; using System.Windows; using System.Windows.Media; namespace LY.Dis ...

  4. pdf增加水印

    /// <summary> /// 为PDF添加水印或背景图片 /// </summary> /// <param name="strSourceFilePat ...

  5. 开发之前的思考-UI结构设计

    UI结构设计遵循的一些要点 1.尽量不要让UI作为Camera的子物体 因为UI和摄像机敏感的关系,尽量不要将UI作为摄像机的子物体,避免出现一些因为透视(3D UI)等问题导致的视觉Bug. 2.尽 ...

  6. WebView重定向新开界面问题-b

    首先介绍下这个问题,iOS上WebView 如果想更贴近native,就要加载新URL的时候新开个界面,但是如果加载的链接有重定向的话,就会在中间开一个空白的界面,这个好烦.然后就是解决这个问题,采用 ...

  7. C# DateTime和DateTime?格式化时间

    DateTime: <%= Model.CreateTime.ToString("yyyy年MM月dd日 H时m分s秒")%>   DateTime?: <%= ...

  8. spring dataSourceRouter自动切换数据源

    spring多数据源的切换,主要用到的是AbstractRoutingDataSource这个路由类,当我们的自定义的一个路由分发类继承AbstractRoutingDataSource类后,重写de ...

  9. mysql 获取季度的第一天 本月的第一天,本周的第一天sql语句(转)

    感谢:http://www.111cn.net/database/110/d45124323da8d2d87b80f78319987eda.htm 查看同主题的另一篇博客:http://blog.cs ...

  10. bzoj 1242: Zju1015 Fishing Net 弦图判定

    1242: Zju1015 Fishing Net弦图判定 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 214  Solved: 81[Submit ...