函数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++获取时间函数众多,何时该用什么函数,拿到的是什么时间?该怎么用?很多人都会混淆. 本文是本人经历了几款游戏客户端和服务器开发后,对游戏中时间获取的一点总结. 最早学习游戏客户端时,为了获取最精确 ... 
随机推荐
- Daily Scrum 11.8
			摘要:本次meeting继续讨论程序的问题以及单元测试和集成测试.本次测试为1.00版本.本次的Task列表如下: Task列表 出席人员 Today's Task Tomorrow's Task 刘 ... 
- Ubuntu实用快捷键
			ALT + TAB: 切换程序窗口Win+w: 显示所有的工作空间,可轻松进行切换 ===== Terminal终端 ===== CTRL + ALT + T: 打开终端 TAB: 自动补全命令或文件 ... 
- OC中的点语法,成员变量的作用域
			点语法 点语法本质是函数的调用,不是像java中那样,是用来访问成员变量的:oc中访问成员变量是用 -> 访问的: Person *p = [Person new]; p.age = 10; / ... 
- mysql存储过程中字符串参数单引号
			注意:存储过程中单引号 ,四个单引号 SET @sql = CONCAT('select user_id into ',m_user_id,' from go_user where mobile = ... 
- centos 7 有点意思
			Centos 7 防火墙 Centos尼马换了防火墙,名叫firewalld,还有iptables命令,这就叫坑爹.整了半个世纪才知道,他换了防火墙.添加滤镜,停止iptables都打不开80端口,简 ... 
- Exception in thread "http-bio-8081-exec-3" java.lang.OutOfMemoryError: PermGen space
			前言: 在http://www.cnblogs.com/wql025/p/4865673.html一文中我曾描述这种异常也提供了解决方式,但效果不太理想,现在用本文的方式,效果显著. 目前此项目只能登 ... 
- 【转】2-SAT题集
			转自:http://blog.csdn.net/shahdza/article/details/7779369 [HDU]3062 Party1824 Let's go home3622 Bomb G ... 
- 01-03-03【Nhibernate (版本3.3.1.4000) 出入江湖】cascade的测试
			相关文章: http://www.cnblogs.com/amboyna/archive/2008/02/18/1072260.html注意上面是hibernate,不是Nhibernate,这解释是 ... 
- unity与Android相互调用
			原地址:http://www.cnblogs.com/ayanmw/p/3727782.html 现在unity 导出的android客户端需要调用 Android 的支付SDK,但是unity与an ... 
- Unity3D研究院之与Android相互传递消息
			原地址:http://www.xuanyusong.com/archives/676 上一篇文章我们学习了Unity向Android发送消息,如果Android又能给Unity回馈消息那么这就玩美了. ... 
