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相关参数的检车和初始化,包括 ...
随机推荐
- 团队项目之NABC
Time:2013-10-22 Author:wang 一个成功的人,总是知道如何管理自己的时间,如何让自己的时间得到最充分最有效的利用.对学生一族而言,课业负担重,各种课程.各种活动.各种社团,如果 ...
- iOS刷新第三方MJRefresh的基本使用
iOS开发中最好用的刷新第三方框架 MJRefresh GitHub : https://github.com/CoderMJLee/MJRefresh UIRefreshControl的介绍 1,U ...
- 文件中的类都不能进行设计,因此未能为该文件显示设计器。设计器检查出文件中有以下类: FormMain --- 未能加载基类“WinForm.Win.FormsBase.FormMainBase”。请确保已引用该程序集并已生成所有项目
出现该问题的原因:FormMain从FormMainBase继承之后,一旦修改FormMainBase就会出现这个问题 解决方案:(1-4是搜索网友的) 1: 关闭VS所有窗口,后重启.即可返回正常. ...
- Text selection in div(contenteditable) when double click
背景: 在最近项目中,碰到一个问题:有一个可编辑的div需要双击时可编辑,blur或者回车时将编辑结果保存.你可能注意到双击时,文字会被选中,可编辑区域不会focus到光标位置.考虑到兼容性问题,写了 ...
- js图片旋转
<script type="text/javascript" language="javascript"> function rotate(id, ...
- Chrome浏览器下调试SASS
网上说的方案各有各的说法,尝试多个才找到有效方案,为避免后来者麻烦,现在讲讲如何调试 笔者ruby版本为3.4.19,因为sass文件的编译是需要ruby环境的,使用sass前需要先安装! 第一步(核 ...
- 【BZOJ】【1085】【SCOI2005】骑士精神
IDA*算法 Orz HZWER A*+迭代加深搜索=IDA* 这题的估价相当于一个可行性剪枝,即如果当前走的步数s+未归位的点数>搜索深度k,则剪枝 /******************** ...
- nenu contest
http://vjudge.net/vjudge/contest/view.action?cid=54393#overview A n^2能过 对第二个n我二分了一下,快了一点点,nlogn #inc ...
- intellij idea 14 ULTIMATE 注册码
Name:happy KEY:63763-YCO0I-QR4TV-G4I3E-4XGK9-GQSQ3
- Eclipse下PHP开发 插件安装
PHPeclipse是什么? PHPeclipse是Eclipse的一个插件,它为php开发人员提供了一个集成的开发环境.Eclipse官方下载地址:http://www.eclipse.org/ P ...