zoukankan      html  css  js  c++  java
  • mysql performance storage engine

    mysql performance storage engine

    概要

    1. mysql的运行时状态记录的存储引擎,实现了PSI(Performance Storage Interface)
    2. 通过WITH_PERFSCHEMA_STORAGE_ENGINE宏来决定是否编译,启用后会自动启用HAVE_PSI_INTERFACE, 该宏会影响mysql_thread_create的行为

    启动过程

    # sql/mysqld.cc:mysqld_main
    # 在sql/sys_vars中声明所有的mysql参数,在sys_var类型的构造函数中将这些参数注册到all_sys_vars
    # 解析命令行和配置文件传入的参数,这里主要是为了解析pfs相关的参数,写入到pfs_param的成员中去
    ho_error = handle_options(&remaining_argc, &remaining_argv,
                               (my_option*)(all_early_options.buffer), NULL);
    if (ho_error == 0) {
        if (pfs_param.m_enabled)
            PSI_hook = initialize_performance_schema(&pfs_param);
    }
    
    if (PSI_hook) 
        # 5.5貌似只有v1
        PSI_server = (PSI*) PSI_hook->get_interface(PSI_CURRENT_VERSION)
    
    if (PSI_server) {
        # psi 开头的key变量的值,会调用注册storage/perfschema/pfs.cc中的register_*函数注册all_server_mutexes, all_server_rwlocks, all_server_threads等变量
        init_server_psi_keys();
    
        PSI_thread *psi = PSI_server->new_thread(key_thread_main, NULL, 0);
        if (psi)
            PSI_server->set_thread(psi);
    
        my_thread_global_reinit();
    
        initialize_performance_schema_acl(opt_bootstrap);
        
        if (!opt_bootstrap) 
            check_performance_schema();
    
        initialize_information_schema_acl();
    
        if (PSI_server) 
            PSI_server->delete_current_thread();
    }
    
    
  • 相关阅读:
    【Vijos1159】岳麓山上打水 [迭代加深]
    【POJ3134】 Power Calculus [迭代加深]
    【2019.1.24】 搜索,动规 经典题目体验赛
    【noip2017】
    【poj3311】Hie With The Pie [状压dp]
    [bzoj3938] [Uoj #88] Robot
    [洛谷P4707] 重返现世
    [洛谷P4097] [HEOI2013] Segment
    KD-tree 学习小记
    NOI2019 酱油记
  • 原文地址:https://www.cnblogs.com/zhedan/p/12488104.html
Copyright © 2011-2022 走看看