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相关参数的检车和初始化,包括 ...
随机推荐
- bnuoj 25662 A Famous Grid (构图+BFS)
http://www.bnuoj.com/bnuoj/problem_show.php?pid=25662 #include <iostream> #include <stdio.h ...
- 【BZOJ】【2561】最小生成树
网络流/最小割 对于所有小于L的边求一个割使得U,V不连通,这样就可以保证L可能在最小生成树里. 最大生成树同理. 答案累加一下即可.(Orz Hzwer) (我一开始怎么会sb地去想到一起求呢……) ...
- 【BZOJ】【2594】【WC2006】水管局长数据加强版
LCT 动态维护MST嘛……但是有删边= =好像没法搞的样子 离线记录所有修改&询问,倒序处理,就可以变删边为加边了- 论如何用LCT维护最小生成树:先搞出一棵最小生成树,然后每次加边(u,v ...
- 20160723数据结构节alexandrali
大坑最后再填. 20160803:心情好回来填啦(5/7) 做的题目是: poj2970 我们先每个人都不给钱qwq 然后我们发现有一位的工作时间超过了d 那么我们就从以前安排过工作的人里,a最大的, ...
- gcd,lcm,ext_gcd,inv
Least Common Multiple http://acm.hdu.edu.cn/showproblem.php?pid=1019 #include<cstdio> int gcd( ...
- SQL Server 之 DBCC
--检查索引碎片情况 dbcc showconfig(tablename) 具体例子: --上图为碎片整理之前 ALTER INDEX ALL on Citation REBUILD --下图为碎片整 ...
- Building Plugins for iOS
This page describes Native Code Plugins for the iOS platform. Building an Application with a Native ...
- aChartEngine图表显示
android的数据报表显示 从图中,我们可以看出,绘制一个图表我们其实,我们只需要理解三个概念 1,ChartFactory ,传入XYMutilpleSeriesRenderer,XYMutilp ...
- Oracle导出空表(从来都没有用过的表)
Oracle11g默认对空表不分配segment,故使用exp导出Oracle11g数据库时,空表不会导出! .设置deferred_segment_creation参数为FALSE后,无论是空表还是 ...
- DP方程及意义
01背包 有N件物品和一个容量为V的背包.第i件物品的费用(即体积,下同)是w[i],价值是c[i].求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量,且价值总和最大. 基本思路: 这是最基 ...