函数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++获取时间函数众多,何时该用什么函数,拿到的是什么时间?该怎么用?很多人都会混淆. 本文是本人经历了几款游戏客户端和服务器开发后,对游戏中时间获取的一点总结. 最早学习游戏客户端时,为了获取最精确 ...
随机推荐
- [转载]C# FTP操作工具类
本文转载自<C# Ftp操作工具类>,仅对原文格式进行了整理. 介绍了几种FTP操作的函数,供后期编程时查阅. 参考一: using System; using System.Collec ...
- mysql Host ‘XXXXXX’ is blocked because of many connection errors
mysql Host ‘XXXXXX’ is blocked because of many connection errors ERROR 1129 (00000): Host ‘XXXXXX’ i ...
- 【POJ】【1704】Georgia and Bob
组合游戏 Nim游戏的一个变形 题解请看金海峰的博客 以下为引用: 分析:我们把棋子按位置升序排列后,从后往前把他们两两绑定成一对.如果总个数是奇数,就把最前面一个和边界(位置为0)绑定. 在同一对棋 ...
- oracle——表修改语句集合
alter table table_name modify column_name default 0;
- C++代码反汇编后的堆栈寄存器EBP和ESP
最近在分析一个进程崩溃的严重问题,其中有些过程分析需要对ebp, esp 有清晰的理解,对于ebp 和esp 相信大家都很熟悉了,但是为了使本文自成体系,我还是解释一下. ebp--栈底指针 esp- ...
- 【AutoMapper】实体类间自动实现映射关系,及其转换。
官方项目下载: http://automapper.codeplex.com/ 博文 http://www.iteye.com/blogs/tag/AutoMapper 图解: 第一步:创建映射Map ...
- How to Enable 64-bit Processes for Enhanced Protected Mode in Internet Explorer 11 (IE11)
Information Enhanced Protected Mode (EPM) adds additional security to Protected Mode and includes ...
- POJ2104 K-th Number Range Tree
又是区间第k大,这次选择这道题是为以后写线段树套平衡树铺路的.Range Tree可以理解成线段树套vector吧,相当于每个结点多存了对应区间的一个排好序的序列.画一下就会知道空间的消耗是nlogn ...
- 2013 ACM-ICPC长沙赛区全国邀请赛——Bottles Arrangement
这题当时竟然没看啊…… 找规律:求和m+m+m-1+m-1+……前n项 ;}
- [2-sat]HDOJ1824 Let's go home
中问题 题意略 和HDOJ 3062一样 这里 每个队员都有 选 和 不选 两种, 即 上篇所说的$x$和$x’$ 建图:队长(a)留下或者其余两名队员(b.c)同时留下 那么就是$a' \Right ...