/** 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. [Linux]学习笔记(4)-su及passwd的用法介绍

    (1)su su命令用于将当前的用户切换到一个指定的用户.语法为: su - user_name 如果用户利用telnet方式远程登录,是不能直接以root账户登录的,也就是说在使用telnet登录服 ...

  2. window.print打印指定div实例代码

    window.print可以打印网页,但有时候我们只希望打印特定控件或内容,怎么办呢,请看下面的例子 首先我们可以把要打印的内容放在div中,然后用下面的代码进行打印. 复制代码代码如下: <h ...

  3. FireFox不支持InnerText的解决方法

    innerText和InnerHTML是非常实用的一个属性,然而在FireFox中不支持此属性,可能是因为考虑到网页的安全性.这样一来为开发者带来了不少麻烦.FireFox中也提供了另外一个属性inn ...

  4. jdbc学习(一)——SqlServer、Oracle和MySQL

    一.jdbc介绍 jdbc全称:java数据库连接(Java Database Connectivity),是sun公司定义的一套访问数据库的规范(接口和类,由各种数据库公司进行实现),主要放在jav ...

  5. 009.EscapeRegExChars

    类型:function 可见性:public 所在单元:RegularExpressionsCore 父类:TPerlRegEx 把转义字符变成原意字符 例如\d意为0~9某个数字,通过此函数转换后则 ...

  6. java 中的匿名内部类

    转自http://www.cnblogs.com/nerxious/archive/2013/01/25/2876489.html 匿名内部类也就是没有名字的内部类 正因为没有名字,所以匿名内部类只能 ...

  7. compared woth QPSK, what is the advantages of QAM(16QAM or 64QAM?)

    1.QPSK QPSK是英文Quadrature Phase Shift Keying的缩略语简称,意为正交相移键控,是一种数字调制方式.在数字信号的调制方式中QPSK四相移键控是目前最常用的一种卫星 ...

  8. what is the purpose of channel coding?(信道编码的作用?)

    信道.信道编码及其作用 1.信道(channel) 信道和通信电路并不等同,用来表示向某一个方向传送信息的媒体.因此一条通信线路往往包含一条发送信道和一条接收信道. 从通信的双方信息交互方式看有三个基 ...

  9. Python urllib2多进程共享cookies

    如果想多个进程共享同一个cookies,不用每个进程都重新登录,可以就cookies保存到一个文件,然后多个进程直接共享一个锁来实现 1.一个进程登录完成后,把cookies保存到一个文件里面 sel ...

  10. IOS6开发环境环境配置

    IOS6开发环境环境配置http://www.wizzer.cn/?p=2438http://diybbs.zol.com.cn/1/34037_629.htmlhttp://diybbs.zol.c ...