码迷,mamicode.com
首页 > 其他好文 > 详细

函数buf_pool_init

时间:2015-11-22 17:13:48      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:

 

/********************************************************************//**
Creates the buffer pool.
@return    DB_SUCCESS if success, DB_ERROR if not enough memory or error */
UNIV_INTERN
ulint
buf_pool_init(
/*==========*/
    ulint    total_size,    /*!< in: size of the total pool in bytes */
    ulint    n_instances)    /*!< in: number of instances */
{
    ulint        i;
    const ulint    size    = total_size / n_instances;

    ut_ad(n_instances > 0);
    ut_ad(n_instances <= MAX_BUFFER_POOLS);
    ut_ad(n_instances == srv_buf_pool_instances);

    /* We create an extra buffer pool instance, this instance is used
    for flushing the flush lists, to keep track of n_flush for all
    the buffer pools and also used as a waiting object during flushing. */
    buf_pool_ptr = mem_zalloc(n_instances * sizeof *buf_pool_ptr);

    for (i = 0; i < n_instances; i++) {
        buf_pool_t*    ptr    = &buf_pool_ptr[i];

        if (buf_pool_init_instance(ptr, size, i) != DB_SUCCESS) {

            /* Free all the instances created so far. */
            buf_pool_free(i);

            return(DB_ERROR);
        }
    }

    buf_pool_set_sizes();
    buf_LRU_old_ratio_update(100 * 3/ 8, FALSE);

    btr_search_sys_create(buf_pool_get_curr_size() / sizeof(void*) / 64);

    return(DB_SUCCESS);
}

 

函数buf_pool_init

标签:

原文地址:http://www.cnblogs.com/taek/p/4986123.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!