函数buf_pool_init

 

/********************************************************************//**
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;
//n_instances 一般为1
const ulint size = total_size / n_instances; ut_ad(n_instances > 0); ut_ad(n_instances <= MAX_BUFFER_POOLS); //#define MAX_BUFFER_POOLS (1 << MAX_BUFFER_POOLS_BITS) 1<<6 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. */

//UNIV_INTERN buf_pool_t* buf_pool_ptr; 通过heap heap = mem_heap_create_func(n, MEM_HEAP_DYNAMIC, file_name, line); 实现 详见 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); }

 

转载于:https://www.cnblogs.com/taek/p/4986123.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值