如下代码为,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);
}
                    版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。