innodb引擎很有意思, 将索引当作核心数据结构. 尤其是对于聚簇索引, 数据就是索引, 索引就是数据.
在彻底解决innodb引擎的设计思想之前, 有必要将核心的数据结构进行说明.
page0types.h
- /* Type of the index page */
- /* The following define eliminates a name collision on HP-UX */
- #define page_t ib_page_t
- typedef byte page_t;
- typedef struct page_search_struct page_search_t;
- typedef struct page_cur_struct page_cur_t;
- /* Index page cursor */
-
- struct page_cur_struct{
- byte* rec; /* pointer to a record on page */
- };
buf0types.h
- /* The info header of a block in a memory heap */
-
- struct mem_block_info_struct {
- ulint magic_n;/* magic number for debugging */
- char file_name[8];/* file name where the mem heap was created */
- ulint line; /* line number where the mem heap wa