mysql的innodb啟動過程

fil_init 主要是初始化文件打開指針哈希表,所有打開的文件全記錄在 fil_system 之中,構造按名字查找的哈希表 

 

buf_pool_init 內存緩沖池的初始化,對應 buf_pool_ptr 數組之中,還初始化瞭 adaptive hash index 的內存

 

log_init 初始化log緩沖區,默認大小為 512*16k, 每個log頁面大小為 #define OS_FILE_LOG_BLOCK_SIZE  512  日志文件在創建過程中也是指定不用系統緩存

  www.aiwalls.com  

 lock_sys_create 初始化系統鎖,就是建瞭一個HASH表,lock_sys

 

 recv_recovery_from_checkpoint_start 開始執行恢復

 

dict_boot 初始化表結構的緩存,dict_sys,建兩個hash表,可以根據表名和表ID查找;初始化系統表,就四個 SYS_TABLES SYS_COLUMNS SYS_INDEXES SYS_FIELDS ;初始化 insert buffer,每一個表空間對應一個;讀入上面四個系統表中的內容

 

trx_sys_init_at_db_start 初初化事務結構體 trx_sys ; Creates the global purge system control structure and inits the history 

 

dict_create_or_check_foreign_constraint_tables 創建另外兩張系統表 SYS_FOREIGN SYS_FOREIGN_COLS  www.aiwalls.com  

 

啟動的線程,

 

IO部分共10個,可通過參數配置

 

1個 insert buffer thread

 

1個 log thread

 

4個 aio read thread

 

4個 aio write thread

 

 

 

1個 lock timeout thread      A thread which wakes up threads whose lock wait may have lasted too long

 

1個 error monitor thread    A thread which prints warnings about semaphore waits which have lasted too long

 

1個 monitor thread           A thread which prints the info output by various InnoDB monitors

 

1個 master thread           The master thread controlling the server

 

1個 thread handle shutdown

 

1個 handle connections socket 專門用來處理連理的

 

1個 trx_rollback_or_clean_all_recovered Rollback the uncommitted transactions which have no user   session  www.aiwalls.com  

 

 

 

struct st_mysql_plugin *mysql_optional_plugins[]=

{

   builtin_innobase_plugin, builtin_perfschema_plugin, builtin_partition_plugin, 0

};

 

struct st_mysql_plugin *mysql_mandatory_plugins[]=

{

  builtin_binlog_plugin, builtin_mysql_password_plugin,  builtin_csv_plugin, builtin_heap_plugin, builtin_myisam_plugin, builtin_myisammrg_plugin, 0

};

初始化的 binlog memory myisam innodb pefformance_schema partition

 

 

 

作者 spche

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。