/** Buffer page (uncompressed or compressed) */
typedef    struct buf_page_struct        buf_page_t;

struct buf_page_struct{
    /** @name General fields
    None of these bit-fields must be modified without holding
    buf_page_get_mutex() [buf_block_struct::mutex or
    buf_pool->zip_mutex], since they can be stored in the same
    machine word.  Some of these fields are additionally protected
    by buf_pool->mutex. */
    /* @{ */

    unsigned    space:;    /*!< tablespace id; also protected
                    by buf_pool->mutex. */
    unsigned    offset:;    /*!< page number; also protected
                    by buf_pool->mutex. */

    unsigned    state:BUF_PAGE_STATE_BITS;
                    /*!< state of the control block; also
                    protected by buf_pool->mutex.
                    State transitions from
                    BUF_BLOCK_READY_FOR_USE to
                    BUF_BLOCK_MEMORY need not be
                    protected by buf_page_get_mutex().
                    @see enum buf_page_state */
#ifndef UNIV_HOTBACKUP
    unsigned    flush_type:;    /*!< if this block is currently being
                    flushed to disk, this tells the
                    flush_type.
                    @see enum buf_flush */
    unsigned    io_fix:;    /*!< type of pending I/O operation;
                    also protected by buf_pool->mutex
                    @see enum buf_io_fix */
    unsigned    buf_fix_count:;/*!< count of how manyfold this block
                    is currently bufferfixed */
    unsigned    buf_pool_index:;/*!< index number of the buffer pool
                    that this block belongs to */
#
#  error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6"
# endif
    /* @} */
#endif /* !UNIV_HOTBACKUP */
    page_zip_des_t    zip;        /*!< compressed page; zip.data
                    (but not the data it points to) is
                    also protected by buf_pool->mutex;
                    state == BUF_BLOCK_ZIP_PAGE and
                    zip.data == NULL means an active
                    buf_pool->watch */
#ifndef UNIV_HOTBACKUP
    buf_page_t*    hash;        /*!< node used in chaining to
                    buf_pool->page_hash or
                    buf_pool->zip_hash */
#ifdef UNIV_DEBUG
    ibool        in_page_hash;    /*!< TRUE if in buf_pool->page_hash */
    ibool        in_zip_hash;    /*!< TRUE if in buf_pool->zip_hash */
#endif /* UNIV_DEBUG */

    /** @name Page flushing fields
    All these are protected by buf_pool->mutex. */
    /* @{ */
    

    /** 该方式很新颖

    #define UT_LIST_NODE_T(TYPE)\
      struct {\
        TYPE * prev; /*!< pointer to the previous node,NULL if start of list */\
        TYPE * next; /*!< pointer to next node, NULL if end of list */\
      }\

    */
    UT_LIST_NODE_T(buf_page_t) list;
                    /*!< based on state, this is a
                    list node, protected either by
                    buf_pool->mutex or by
                    buf_pool->flush_list_mutex,
                    in one of the following lists in
                    buf_pool:

                    - BUF_BLOCK_NOT_USED:    free
                    - BUF_BLOCK_FILE_PAGE:    flush_list
                    - BUF_BLOCK_ZIP_DIRTY:    flush_list
                    - BUF_BLOCK_ZIP_PAGE:    zip_clean
                    - BUF_BLOCK_ZIP_FREE:    zip_free[]

                    If bpage is part of flush_list
                    then the node pointers are
                    covered by buf_pool->flush_list_mutex.
                    Otherwise these pointers are
                    protected by buf_pool->mutex.

                    The contents of the list node
                    is undefined if !in_flush_list
                    && state == BUF_BLOCK_FILE_PAGE,
                    or if state is one of
                    BUF_BLOCK_MEMORY,
                    BUF_BLOCK_REMOVE_HASH or
                    BUF_BLOCK_READY_IN_USE. */

#ifdef UNIV_DEBUG
    ibool        in_flush_list;    /*!< TRUE if in buf_pool->flush_list;
                    when buf_pool->flush_list_mutex is
                    free, the following should hold:
                    in_flush_list
                    == (state == BUF_BLOCK_FILE_PAGE
                        || state == BUF_BLOCK_ZIP_DIRTY)
                    Writes to this field must be
                    covered by both block->mutex
                    and buf_pool->flush_list_mutex. Hence
                    reads can happen while holding
                    any one of the two mutexes */
    ibool        in_free_list;    /*!< TRUE if in buf_pool->free; when
                    buf_pool->mutex is free, the following
                    should hold: in_free_list
                    == (state == BUF_BLOCK_NOT_USED) */
#endif /* UNIV_DEBUG */
    ib_uint64_t    newest_modification;
                    /*!< log sequence number of
                    the youngest modification to
                    this block, zero if not
                    modified. Protected by block
                    mutex */
    ib_uint64_t    oldest_modification;
                    /*!< log sequence number of
                    the START of the log entry
                    written of the oldest
                    modification to this block
                    which has not yet been flushed
                    on disk; zero if all
                    modifications are on disk.
                    Writes to this field must be
                    covered by both block->mutex
                    and buf_pool->flush_list_mutex. Hence
                    reads can happen while holding
                    any one of the two mutexes */
    /* @} */
    /** @name LRU replacement algorithm fields
    These fields are protected by buf_pool->mutex only (not
    buf_pool->zip_mutex or buf_block_struct::mutex). */
    /* @{ */

    UT_LIST_NODE_T(buf_page_t) LRU;
                    /*!< node of the LRU list */
#ifdef UNIV_DEBUG
    ibool        in_LRU_list;    /*!< TRUE if the page is in
                    the LRU list; used in
                    debugging */
#endif /* UNIV_DEBUG */
    unsigned    old:;        /*!< TRUE if the block is in the old
                    blocks in buf_pool->LRU_old */
    unsigned    freed_page_clock:;/*!< the value of
                    buf_pool->freed_page_clock
                    when this block was the last
                    time put to the head of the
                    LRU list; a thread is allowed
                    to read this for heuristic
                    purposes without holding any
                    mutex or latch */
    /* @} */
    unsigned    access_time;    /*!< time of first access, or
                    0 if the block was never accessed
                    in the buffer pool. Protected by
                    block mutex */
# if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
    ibool        file_page_was_freed;
                    /*!< this is set to TRUE when fsp
                    frees a page in buffer pool */
# endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */
};

结构体buf_page_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将字符串中的数字提取出来的功能做了一个小总结,总结三种方法如下: ...

  2. php5 图片验证码一例

    php5 图片验证码. GD库的函数1,imagecreatetruecolor -----创建一个真彩色的图像imagecreatetruecolor(int x_size,int y_size) ...

  3. php正确解码javascript中通过escape编码后的字符

    js的escape如何在PHP中来解呢? 下面的这个函数可以正确的解析,网上有不少unescape的函数,但好用的不多. 这是很久以前收集的一个,不知道谁写的了,但经过测试没有问题~ function ...

  4. J2EE中文乱码处理

    在JAVA WEB开发的过程中,经常会遇到中文乱码的情况,中文乱码主要是在浏览器与服务器交互传递数据的时候发生的.对于这个棘手的问题,我参考(韩顺平老师)视频将处理方法总结与此,供自己以及大家开发的时 ...

  5. 编码错误设置错误报 "SyntaxError: Non-ASCII character '/xe6' "

    无意中碰到键盘导致一段处理中文拼音的 python 代码跑起来报了个错 “SyntaxError: Non-ASCII character ‘/xe6' " 看了下是注释 # coding: ...

  6. Mac下使用sublime text 2开发Python

    入门虽易, 熟练不易, 且行且珍惜 简介:这只是简单介绍一个好的文本工具sublime text的使用,如果要获得详细的教程可以去看这本书<Sublime Productivity>和一些 ...

  7. VS2010中无法嵌入互操作类型“......”,请改用适用的接口的解决方法

  8. 【面试题】Https

    https原理, 我很难一下子记住,   https=http+ssl 先说http,  基于tcp/IP协议 传输,有三次握手 http://blog.csdn*net/xubo_zhang/art ...

  9. How to open MS word document from the SharePoint 2010 using Microsoft.Office.Interop.dll

    or this you must change the identity of word component inC:\windows\System32\comexp.mscto be interac ...

  10. bnu 4359 无爱编号(规律)

    http://www.bnuoj.com/bnuoj/problem_show.php?pid=4359 [题意]:输入N,表示几位数,0-这个N位数,有多少个满足条件的号码,不满足的情况为出现4,1 ...