开发者社区> 问答> 正文

什么是“a block is a sentinel for a buffer pool watch.”

如下代码为,mysql在做buffer pool load时,如果某一个page既在内存,同时也不符合“a block is a sentinel for a buffer pool watch.”,则跳过此page的加载。

watch_page = buf_page_hash_get_low(buf_pool, page_id);
    if (watch_page && !buf_pool_watch_is_sentinel(buf_pool, watch_page)) {
        /* The page is already in the buffer pool. */
        watch_page = NULL;
        rw_lock_x_unlock(hash_lock);
        if (block) {
            buf_page_mutex_enter(block);
            buf_LRU_block_free_non_file_page(block);
            buf_page_mutex_exit(block);
        }

        bpage = NULL;
        goto func_exit;
    }
/** Determine if a block is a sentinel for a buffer pool watch.
@param[in]    buf_pool    buffer pool instance
@param[in]    bpage        block
@return TRUE if a sentinel for a buffer pool watch, FALSE if not */
ibool
buf_pool_watch_is_sentinel(
    const buf_pool_t*    buf_pool,
    const buf_page_t*    bpage)
{
    /* We must also own the appropriate hash lock. */
    ut_ad(buf_page_hash_lock_held_s_or_x(buf_pool, bpage));
    ut_ad(buf_page_in_file(bpage));

    if (bpage < &buf_pool->watch[0]
        || bpage >= &buf_pool->watch[BUF_POOL_WATCH_SIZE]) {

        ut_ad(buf_page_get_state(bpage) != BUF_BLOCK_ZIP_PAGE
              || bpage->zip.data != NULL);

        return(FALSE);
    }

    ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_PAGE);
    ut_ad(!bpage->in_zip_hash);
    ut_ad(bpage->in_page_hash);
    ut_ad(bpage->zip.data == NULL);
    return(TRUE);
}

展开
收起
sun_ashe 2017-12-14 21:29:28 2686 0
1 条回答
写回答
取消 提交回答
  • 一个热爱科技,热爱生活的阳光男孩

    这个?

    2019-07-17 21:49:10
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载