函数fsp_try_extend_data_file
扩展表空间
/***********************************************************************//**
Tries to extend the last data file of a tablespace if it is auto-extending.
@return FALSE if not auto-extending */
static __attribute__((nonnull))
ibool
fsp_try_extend_data_file(
/*=====================*/
ulint* actual_increase,/*!< out: actual increase in pages, where
we measure the tablespace size from
what the header field says; it may be
the actual file size rounded down to
megabyte */
ulint space, /*!< in: space */
fsp_header_t* header, /*!< in/out: space header */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
ulint size;
ulint zip_size;
ulint new_size;
ulint old_size;
ulint size_increase;
ulint actual_size;
ibool success;
*actual_increase = ;
//UNIV_INTERN ibool srv_auto_extend_last_data_file = FALSE;
&& !srv_auto_extend_last_data_file) {
/* We print the error message only once to avoid
spamming the error log. Note that we don't need
to reset the flag to FALSE as dealing with this
error requires server restart. */
if (fsp_tbs_full_error_printed == FALSE) {
fprintf(stderr,
"InnoDB: Error: Data file(s) ran"
" out of space.\n"
"Please add another data file or"
" use \'autoextend\' for the last"
" data file.\n");
fsp_tbs_full_error_printed = TRUE;
}
return(FALSE);
}
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
zip_size = dict_table_flags_to_zip_size(
mach_read_from_4(header + FSP_SPACE_FLAGS));
old_size = size;
) {
/**
* if != 0, this tells the max size auto-extending may increase the last data file size
* UNIV_INTERN ulint srv_last_file_size_max = 0;
*
*#define SRV_AUTO_EXTEND_INCREMENT \
(srv_auto_extend_increment * ((1024 * 1024) / UNIV_PAGE_SIZE))
====> 8*((1024*1024)/16k) 为512个page,共计8M (默认为8M)
*/
if (!srv_last_file_size_max) {
size_increase = SRV_AUTO_EXTEND_INCREMENT;
} else {
...
}
} else {
/* We extend single-table tablespaces first one extent
at a time, but for bigger tablespaces more. It is not
enough to extend always by one extent, because some
extents are frag page extents. */
ulint extent_size; /*!< one megabyte, in pages */
if (!zip_size) {
extent_size = FSP_EXTENT_SIZE;
} else {
extent_size = FSP_EXTENT_SIZE
* UNIV_PAGE_SIZE / zip_size;
}
if (size < extent_size) {
/* Let us first extend the file to extent_size */
success = fsp_try_extend_data_file_with_pages(
space, extent_size - , header, mtr);
if (!success) {
new_size = mtr_read_ulint(header + FSP_SIZE,
MLOG_4BYTES, mtr);
*actual_increase = new_size - old_size;
return(FALSE);
}
size = extent_size;
}
* extent_size) {
size_increase = extent_size;
} else {
/* Below in fsp_fill_free_list() we assume
that we add at most FSP_FREE_ADD extents at
a time */
size_increase = FSP_FREE_ADD * extent_size;
}
}
) {
return(TRUE);
}
//当前size+512个page
success = fil_extend_space_to_desired_size(&actual_size, space,size + size_increase);//详见 /* We ignore any fragments of a full megabyte when storing the size
to the space header */
if (!zip_size) {
new_size = ut_calc_align_down(actual_size,
( * ) / UNIV_PAGE_SIZE);
} else {
new_size = ut_calc_align_down(actual_size,
( * ) / zip_size);
}
mlog_write_ulint(header + FSP_SIZE, new_size, MLOG_4BYTES, mtr);
*actual_increase = new_size - old_size;
return(TRUE);
}
函数fsp_try_extend_data_file的更多相关文章
- Python 小而美的函数
python提供了一些有趣且实用的函数,如any all zip,这些函数能够大幅简化我们得代码,可以更优雅的处理可迭代的对象,同时使用的时候也得注意一些情况 any any(iterable) ...
- 探究javascript对象和数组的异同,及函数变量缓存技巧
javascript中最经典也最受非议的一句话就是:javascript中一切皆是对象.这篇重点要提到的,就是任何jser都不陌生的Object和Array. 有段时间曾经很诧异,到底两种数据类型用来 ...
- JavaScript权威指南 - 函数
函数本身就是一段JavaScript代码,定义一次但可能被调用任意次.如果函数挂载在一个对象上,作为对象的一个属性,通常这种函数被称作对象的方法.用于初始化一个新创建的对象的函数被称作构造函数. 相对 ...
- C++对C的函数拓展
一,内联函数 1.内联函数的概念 C++中的const常量可以用来代替宏常数的定义,例如:用const int a = 10来替换# define a 10.那么C++中是否有什么解决方案来替代宏代码 ...
- 菜鸟Python学习笔记第一天:关于一些函数库的使用
2017年1月3日 星期二 大一学习一门新的计算机语言真的很难,有时候连函数拼写出错查错都能查半天,没办法,谁让我英语太渣. 关于计算机语言的学习我想还是从C语言学习开始为好,Python有很多语言的 ...
- javascript中的this与函数讲解
前言 javascript中没有块级作用域(es6以前),javascript中作用域分为函数作用域和全局作用域.并且,大家可以认为全局作用域其实就是Window函数的函数作用域,我们编写的js代码, ...
- 复杂的 Hash 函数组合有意义吗?
很久以前看到一篇文章,讲某个大网站储存用户口令时,会经过十分复杂的处理.怎么个复杂记不得了,大概就是先 Hash,结果加上一些特殊字符再 Hash,结果再加上些字符.再倒序.再怎么怎么的.再 Hash ...
- JS核心系列:浅谈函数的作用域
一.作用域(scope) 所谓作用域就是:变量在声明它们的函数体以及这个函数体嵌套的任意函数体内都是有定义的. function scope(){ var foo = "global&quo ...
- C++中的时间函数
C++获取时间函数众多,何时该用什么函数,拿到的是什么时间?该怎么用?很多人都会混淆. 本文是本人经历了几款游戏客户端和服务器开发后,对游戏中时间获取的一点总结. 最早学习游戏客户端时,为了获取最精确 ...
随机推荐
- Unity3D 利用NGUI2.6.3做技能冷却的CD效果
转自http://blog.csdn.net/qqmcy/article/details/9469021 NGUI非常强大我们今天来学习一下,如何利用NGUI做技能冷却的CD效果.先导入NGUI的插件 ...
- android 开发上传图片遇到返回 FileNotFoundException
目的:带有参数上传图片 环境:客户端开发 android studio ,服务器端:visual studio 2012 (c# asp.net) ************************* ...
- c++ freelockquque
http://www.boost.org/doc/libs/1_56_0/doc/html/boost/lockfree/queue.html Class template queue boost:: ...
- C# \uxxx Unicode编码解码
/// <summary> /// Unicode编码 /// </summary> /// <param name="str"></pa ...
- 01-03-02-2【Nhibernate (版本3.3.1.4000) 出入江湖】CRUP操作-Save方法的一些问题
此文由于当时不知道NHibernate的Sava方法不是更新操作,不知道Save就是Add,造成如下荒唐的求证过程,但结论是对的 ,可报废此文,特此声明. NHibernate--Save方法: Cu ...
- sgu 138
自己猜测了一下 按比赛次数 从大到小排 然后类似于模拟 先排胜的场次 当只剩一场 将它定义为败 #include <cstdio> #include <cstdlib> # ...
- UVA 11806 Cheerleaders (组合+容斥原理)
自己写的代码: #include <iostream> #include <stdio.h> #include <string.h> /* 题意:相当于在一个m*n ...
- C# 知识笔记
HttpContext.Request.Form.ToString() 获取Form表单中的内容 /// <summary> /// 获取 GET 提交方式值 /// </summa ...
- Git PHP提交
做了个小的DEMO,可以查看: https://github.com/feixiang/webgit.git 这几天一直在郁闷的事情. Git在shell里面执行得好好的,apache运行用户也改成了 ...
- 适合我胃口的angular.js学习资料
断断续续弄了半年的ANGULAR.JS学习资料,网上下载了N多资料,测试了很多次. 现在只能算是入门,因时间问题,现在要转入其它领域. 如果以后要拾起来,下面这个PDF比较对我胃口. <Angu ...