宏buf_pool_t

 

typedef    struct buf_pool_struct        buf_pool_t;


struct buf_pool_struct{

    /** @name General fields */
    /* @{ */
    mutex_t        mutex;        /*!< Buffer pool mutex of this
                    instance */
    mutex_t        zip_mutex;    /*!< Zip mutex of this buffer
                    pool instance, protects compressed
                    only pages (of type buf_page_t, not
                    buf_block_t */
    ulint        instance_no;    /*!< Array index of this buffer
                    pool instance */
    ulint        old_pool_size;  /*!< Old pool size in bytes */
    ulint        curr_pool_size;    /*!< Current pool size in bytes */
    ulint        LRU_old_ratio;  /*!< Reserve this much of the buffer
                    pool for "old" blocks */
#ifdef UNIV_DEBUG
    ulint        buddy_n_frames; /*!< Number of frames allocated from
                    the buffer pool to the buddy system */
#endif
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
    ulint        mutex_exit_forbidden; /*!< Forbid release mutex */
#endif
    ulint        n_chunks;    /*!< number of buffer pool chunks */
    buf_chunk_t*    chunks;        /*!< buffer pool chunks */
    ulint        curr_size;    /*!< current pool size in pages */
    hash_table_t*    page_hash;    /*!< hash table of buf_page_t or
                    buf_block_t file pages,
                    buf_page_in_file() == TRUE,
                    indexed by (space_id, offset) */
    hash_table_t*    zip_hash;    /*!< hash table of buf_block_t blocks
                    whose frames are allocated to the
                    zip buddy system,
                    indexed by block->frame */
    ulint        n_pend_reads;    /*!< number of pending read
                    operations */
    ulint        n_pend_unzip;    /*!< number of pending decompressions */

    time_t        last_printout_time;
                    /*!< when buf_print_io was last time
                    called */
    buf_buddy_stat_t buddy_stat[BUF_BUDDY_SIZES + 1];
                    /*!< Statistics of buddy system,
                    indexed by block size */
    buf_pool_stat_t    stat;        /*!< current statistics */
    buf_pool_stat_t    old_stat;    /*!< old statistics */

    /* @} */

    /** @name Page flushing algorithm fields */

    /* @{ */

    mutex_t        flush_list_mutex;/*!< mutex protecting the
                    flush list access. This mutex
                    protects flush_list, flush_rbt
                    and bpage::list pointers when
                    the bpage is on flush_list. It
                    also protects writes to
                    bpage::oldest_modification */
    UT_LIST_BASE_NODE_T(buf_page_t) flush_list;
                    /*!< base node of the modified block
                    list */
    ibool        init_flush[BUF_FLUSH_N_TYPES];
                    /*!< this is TRUE when a flush of the
                    given type is being initialized */
    ulint        n_flush[BUF_FLUSH_N_TYPES];
                    /*!< this is the number of pending
                    writes in the given flush type */
    os_event_t    no_flush[BUF_FLUSH_N_TYPES];
                    /*!< this is in the set state
                    when there is no flush batch
                    of the given type running */
    ib_rbt_t*    flush_rbt;    /*!< a red-black tree is used
                    exclusively during recovery to
                    speed up insertions in the
                    flush_list. This tree contains
                    blocks in order of
                    oldest_modification LSN and is
                    kept in sync with the
                    flush_list.
                    Each member of the tree MUST
                    also be on the flush_list.
                    This tree is relevant only in
                    recovery and is set to NULL
                    once the recovery is over.
                    Protected by flush_list_mutex */
    ulint        freed_page_clock;/*!< a sequence number used
                    to count the number of buffer
                    blocks removed from the end of
                    the LRU list; NOTE that this
                    counter may wrap around at 4
                    billion! A thread is allowed
                    to read this for heuristic
                    purposes without holding any
                    mutex or latch */
    ulint        LRU_flush_ended;/*!< when an LRU flush ends for a page,
                    this is incremented by one; this is
                    set to zero when a buffer block is
                    allocated */
    /* @} */

    /** @name LRU replacement algorithm fields */
    /* @{ */

    UT_LIST_BASE_NODE_T(buf_page_t) free;
                    /*!< base node of the free
                    block list */
    UT_LIST_BASE_NODE_T(buf_page_t) LRU;
                    /*!< base node of the LRU list */
    buf_page_t*    LRU_old;    /*!< pointer to the about
                    LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
                    oldest blocks in the LRU list;
                    NULL if LRU length less than
                    BUF_LRU_OLD_MIN_LEN;
                    NOTE: when LRU_old != NULL, its length
                    should always equal LRU_old_len */
    ulint        LRU_old_len;    /*!< length of the LRU list from
                    the block to which LRU_old points
                    onward, including that block;
                    see buf0lru.c for the restrictions
                    on this value; 0 if LRU_old == NULL;
                    NOTE: LRU_old_len must be adjusted
                    whenever LRU_old shrinks or grows! */

    UT_LIST_BASE_NODE_T(buf_block_t) unzip_LRU;
                    /*!< base node of the
                    unzip_LRU list */

    /* @} */
    /** @name Buddy allocator fields
    The buddy allocator is used for allocating compressed page
    frames and buf_page_t descriptors of blocks that exist
    in the buffer pool only in compressed form. */
    /* @{ */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
    UT_LIST_BASE_NODE_T(buf_page_t)    zip_clean;
                    /*!< unmodified compressed pages */
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
    UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES];
                    /*!< buddy free lists */

    buf_page_t            watch[BUF_POOL_WATCH_SIZE];
                    /*!< Sentinel records for buffer
                    pool watches. Protected by
                           buf_pool->mutex. */

#if BUF_BUDDY_HIGH != UNIV_PAGE_SIZE
# error "BUF_BUDDY_HIGH != UNIV_PAGE_SIZE"
#endif
#if BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE
# error "BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE"
#endif
    /* @} */
};

 

你可能感兴趣的:(宏buf_pool_t)