5 从plugin_init()看存储引擎的初始化

一、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_
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值