/** 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. Android桌面悬浮清内存app概述

    今天闲来无事写了一个清内存的小东西,类似360,在桌面上悬浮,点击后清除后台无用程序,清除后台程序是通过调用ActivityManger.killBackgroundProcesses的方式来进行的, ...

  2. php 生成器 入门理解

    概念太晦涩,看不懂,直接上例子: 问题:得到一个1-1000000的整数数组,然后用foreach遍历输出 如果没有生成器,这样做: $arr=range(1,1000000);//这个函数最终会返回 ...

  3. 《疯狂的android讲义第3版》读书笔记

    第一章.开始启程,你的第一行android代码 1.android系统架构: 1)linux内核层:为底层硬件提供驱动,如显示驱动.音频驱动.照相机驱动.蓝牙驱动.Wifi驱动.电源管理等 2)系统运 ...

  4. LM算法

    最小二乘法的概念 最小二乘法的目标:求误差的最小平方和,对应有两种:线性和非线性. 线性最小二乘的解是closed-form即x=(A^T A)^{-1}A^Tb, 而非线性最小二乘没有closed- ...

  5. Printer Queue

    Description The only printer in the computer science students' union is experiencing an extremely he ...

  6. Entity Framework 安装出现问题

    Entity Framework 详情请看: http://ulfqbpl.blog.163.com/blog/static/8778355220126272473276/

  7. 两年的坚持,最后还是决定将ISoft开源

    还记得2011年9月份,我在上大四,本来想着考研能上个好点的学校,可我怎么就不愿去自习室上自习.每天晚上睡觉前都告诉自己明天早晨一定早起去上自习,但又每次醒来都不想起床啊,懒,没办法.睡到不想再睡了才 ...

  8. 改变navigationbar 标题颜色

    navigationController.navigationBar.titleTextAttributes=@{NSForegroundColorAttributeName:[UIColor yel ...

  9. 1022: [SHOI2008]小约翰的游戏John - BZOJ

    Description 小约翰经常和他的哥哥玩一个非常有趣的游戏:桌子上有n堆石子,小约翰和他的哥哥轮流取石子,每个人取的时候,可以随意选择一堆石子,在这堆石子中取走任意多的石子,但不能一粒石子也不取 ...

  10. HTML5 中的块级链接

    英文叫做 “Block-level” links,我以为只有我厂那些鸟毛不知道,没想到不知道的还挺多, 需要普及一下. 最近看了 kejun 的 PPT 前端开发理论热点面对面:从怎么看,到怎么做?, ...