一、plugin_init
main()------->init_server_components()-------->plugin_init(&remaining_argc, remaining_argv, ...)
1、register_builtin()将plugin(类型为struct st_mysql_plugin)的指针保存到plugin_array这个动态数组和plugin_hash[type]这个哈希表中,内容保存到plugin_mem_root中。
2、调用plugin_initialize(),进一步调用ha_initialize_handlerton(st_plugin_int *plugin)。st_plugin_int结构体实际上是A handle of a plugin,它包含struct st_mysql_plugin *plugin、ref_count引用计数。
二、ha_initialize_handlerton(st_plugin_int *plugin)
1、为handlerton *hton分配内存。
2、调用plugin->plugin->init(hton),进一步调用innobase_init(hton)(位于storage/innobase/handler/ha_innodb.cc中)
三、innobase_init(void *p)
1、handlerton *innobase_hton= (handlerton *)p,并初始化它。
innobase_hton->state = SHOW_OPTION_YES; //设置状态
innobase_hton->db_type= DB_TYPE_INNODB;
innobase_hton->savepoint_offset=sizeof(trx_named_savept_t);
innobase_hton->close_connection=innobase_close_connection;
innobase_hton->savepoint_set=innobase_savepoint;
innobase_hton->savepoint_rollback=innobase_rollback_to_savepoint;
innobase_hton->savepoint_release=innobase_release_savepoint;
innobase_hton->commit=innobase_commit;
innobase_hton->rollback=innobase_rollback;
innobase_hton->prepare=innobase_xa_prepare;
innobase_hton->recover=innobase_xa_recover;
innobase_hton->commit_by_xid=innobase_commit_by_xid;
innobase_hton->rollback_by_xid=innobase_rollback_by_xid;
innobase_hton->create_cursor_read_view=innobase_create_cursor_