fil_space_create
/*******************************************************************//**
Creates a space memory object and puts it to the tablespace memory cache. If
there is an error, prints an error message to the .err log.
@return TRUE if success */
UNIV_INTERN
ibool
fil_space_create(
/*=============*/
const char* name, /*!< in: space name */
ulint id, /*!< in: space id */
ulint flags, /*!< in: compressed page size
and file format, or 0 */
ulint purpose)/*!< in: FIL_TABLESPACE, or FIL_LOG if log */
{
fil_space_t* space;
/* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for
ROW_FORMAT=COMPACT
((table->flags & ~(~0 << DICT_TF_BITS)) == DICT_TF_COMPACT) and
ROW_FORMAT=REDUNDANT (table->flags == 0). For any other
format, the tablespace flags should equal
(table->flags & ~(~0 << DICT_TF_BITS)). */
ut_a(flags != DICT_TF_COMPACT);
ut_a(!(flags & (~0UL << DICT_TF_BITS)));
try_again:
/*printf(
"InnoDB: Adding tablespace %lu of name %s, purpose %lu\n", id, name,
purpose);*/
ut_a(fil_system);
ut_a(name);
mutex_enter(&fil_system->mutex);
space = fil_space_get_by_name(name);
if (UNIV_LIKELY_NULL(space)) {
goto try_again;
}
space = fil_space_get_by_id(id);
if (UNIV_LIKELY_NULL(space)) { return(FALSE);
}
/** *结构体详见 */
space = mem_alloc(sizeof(fil_space_t));
space->name = mem_strdup(name);
space->id = id;
fil_system->tablespace_version++;
space->tablespace_version = fil_system->tablespace_version;
space->mark = FALSE;
if (UNIV_LIKELY(purpose == FIL_TABLESPACE && !recv_recovery_on)
&& UNIV_UNLIKELY(id > fil_system->max_assigned_id)) {
if (!fil_system->space_id_reuse_warned) {
}
fil_system->max_assigned_id = id;
}
space->stop_ios = FALSE;
space->stop_new_ops = FALSE;
space->purpose = purpose;
space->size = ;
space->flags = flags;
space->n_reserved_extents = ;
space->n_pending_flushes = ;
space->n_pending_ops = ;
//初始化chain链表
UT_LIST_INIT(space->chain);
space->magic_n = FIL_SPACE_MAGIC_N;
rw_lock_create(fil_space_latch_key, &space->latch, SYNC_FSP);
//分别以id和name作为哈希值,放入fil_system相应哈希表中
HASH_INSERT(fil_space_t, hash, fil_system->spaces, id, space);
HASH_INSERT(fil_space_t, name_hash, fil_system->name_hash,ut_fold_string(name), space);
space->is_in_unflushed_spaces = FALSE;
//放入lru中
UT_LIST_ADD_LAST(space_list, fil_system->space_list, space);
mutex_exit(&fil_system->mutex);
return(TRUE);
}
/*******************************************************************//**
Returns the table space by a given name, NULL if not found. */
UNIV_INLINE
fil_space_t*
fil_space_get_by_name(
/*==================*/
const char* name) /*!< in: space name */
{
fil_space_t* space;
ulint fold;
ut_ad(mutex_own(&fil_system->mutex));
fold = ut_fold_string(name);
HASH_SEARCH(name_hash, fil_system->name_hash, fold,
fil_space_t*, space,
ut_ad(space->magic_n == FIL_SPACE_MAGIC_N),
!strcmp(name, space->name));
return(space);
}
fil_space_create的更多相关文章
- fil_system_struct
/** The tablespace memory cache */ typedef struct fil_system_struct fil_system_t; /** The tablespace ...
- Innodb物理存储结构系列1
本篇先介绍 下Innodb表空间,文件相关的内存数据结构. 1. 数据结构 Innodb的tablespace和文件的关系,是一对多的关系,先来看三个结构体 1. fil_system_struct: ...
- InnoDB undo log物理结构的初始化
水平有限,如果有误请指出.一直以来未对Innodb 的undo进行好好的学习,最近刚好有点时间准备学习一下,通过阿里内核月报和自己看代码的综合总结一下.本文环境: 代码版本 percona 5.7.2 ...
- MySQL启动过程详解三:Innodb存储引擎的启动
Innodb启动过程如下: 1. 初始化innobase_hton,它是一个handlerton类型的指针,以便在server层能够调用存储引擎的接口. 2. Innodb相关参数的检车和初始化,包括 ...
随机推荐
- WebClient
Mircsoft在dotnet1.1框架下提供的向 URI 标识的资源发送数据和从 URI 标识的资源接收数据的公共方法.通过这个类,大家可以在脱离浏览器的基础上模拟浏览器对互联网上的资源的访问和发送 ...
- 2463: [中山市选2009]谁能赢呢?- BZOJ
Description小明和小红经常玩一个博弈游戏.给定一个n×n的棋盘,一个石头被放在棋盘的左上角.他们轮流移动石头.每一回合,选手只能把石头向上,下,左,右四个方向移动一格,并且要求移动到的格子之 ...
- 让站长在SEO时更得心应手的六个细节
分析一下SEO的心得,希望能对很多做网站优化和做网站推广的站长有帮助,现在做SEO的人越来网站推广越多,即使很多人在做,但不知道自己能否成功,自己的优化是否会见效,所以在这里还是来分享一下咱们在SEO ...
- 【DP】BZOJ 1260: [CQOI2007]涂色paint
1260: [CQOI2007]涂色paint Time Limit: 30 Sec Memory Limit: 64 MBSubmit: 893 Solved: 540[Submit][Stat ...
- 首次push本地代码到github上出现的问题及解决方案
刚创建的github版本库,在push代码时出错: $ git push -u origin masterTo git@github.com:******/Demo.git ! [rejected] ...
- 【Asp.Net-- 杂七杂八】的代码
Request.Url.PathAndQuery public RedirectResult AddToCart(Cart cart, int productId, string returnUrl) ...
- 【Asp.Net MVC--资料汇总】杂七杂八
Html.RenderPartial与Html.RenderAction的区别 http://blog.sina.com.cn/s/blog_8278b1800100zkn0.html ASP.NET ...
- sublime text3 配置插件包记录
前言: 很多插件已经开始放弃支持ST2了,所以推荐使用ST3,大量的最新插件和最新功能已经不再支持st2了. 下载地址戳这里:http://www.sublimetext.com/3 1.所有插件 易 ...
- MYSQL存储过程中常使用的命令记录
MYSQL存储过程中常使用的命令记录 1.触发器trigger 查看:show triggers; 2.存储过程procedure 查看:show procedure status; 查看详细:sho ...
- HDU 1573 X问题 (中国剩余定理)
题目链接 题意 : 中文题不详述. 思路 : 中国剩余定理.求中国剩余定理中解的个数.看这里看这里 #include <stdio.h> #include <iostream> ...