一级女人毛片人一女人-一级女性大黄生活片免费-一级女性全黄久久生活片-一级女性全黄生活片免费-国产美女在线一区二区三区-国产美女在线观看

始創于2000年 股票代碼:831685
咨詢熱線:0371-60135900 注冊有禮 登錄
  • 掛牌上市企業
  • 60秒人工響應
  • 99.99%連通率
  • 7*24h人工
  • 故障100倍補償
您的位置: 網站首頁 > 幫助中心>文章內容

MySQL源代碼閱讀筆記:代碼流程

發布時間:  2012/9/3 17:16:02

代碼分析基于最新的5.5.21

Mysql服務器的main()在/sql/main.cc,實際的入口點在/sql/mysqld.cc。

我們直接從mysqld_main()開始閱讀。

先理解一些比較重要的宏定義:

(1)宏HAVE_NPTL:

這個宏如果打開了會去讀一個系統變量LD_ASSUME_KERNEL,并把他賦給一個全局變量ld_assume_kernel_is_set,這個系統變量設置了系統線程的實現模型。linux內核在2.6版本后,缺省的線程模型是NPTL。-
 


http://www.linuxidc.com/Linux/2012-03/56277.htm    詳細情況請閱讀我博客里的這篇文章。

對于以HAVE_前綴的的宏,另有如下文章闡述:

http://www.linuxidc.com/Linux/2012-03/56278.htm  這里介紹了CMake的相關知識,通過CMake在影子編譯目錄的include目錄里面生成了my_config.h文件。

my_config.h文件通過my_global.h文件包含到具體的需要使用HAVE_前綴的宏的源文件中。

(2)EMBEDDED_LIBRARY

該宏用于控制  嵌入式庫和客戶端/服務器版本不同的那部分代碼。

Mysql 可以編譯為一個libmysqld庫(嵌入式服務器),使用嵌入式MySQL服務器庫,能夠在客戶端應用程序中使用具備全部特性的MySQL服務器。

主要優點在于,增加了速度,并使得嵌入式應用程序的管理更簡單。嵌入式服務器庫是以MySQL的客戶端/服務器版本為基礎的,采用C/C++語言編寫。 其結果是嵌入式服務器也是用C/C++語言編寫的。 在其他語言中,嵌入式服務器不可用。

這個宏可以通過CMake配置,

-DWITH_EMBEDDED_SERVER=1 打開這個宏

在plug.cmake函數里有它的定義:

PROPERTIES COMPILE_DEFINITIONS "MYSQL_SERVER;EMBEDDED_LIBRARY")

整個代碼的流程如下:我們講分更細的文章詳細介紹每部分:

Mysql服務器監聽:

 

Mysql 源代碼的目錄結構 :(以下來自官方文檔)

/BUILD The compilation configuration and make files for all platforms supported.
Use this folder for compilation and linking.
/client The MySQL command-line client tool.
/dbug Utilities for use in debugging (see Chapter 5 for more details).
/Docs Documentation for the current release. Linux users should usegenerate-text-files.pl in the support subfolder to generate the documentation. Windows users are provided with a manual.chm file.
/include The base system include files and headers.
/libmysql The C client API used for creating embedded systems. (See Chapter 6 formore details.)
/libmysqld The core server API files. Also used in creating embedded systems.(See Chapter 6 for more details.)
/mysql-test The MySQL system test suite. (See Chapter 4 for more details.)
/mysys The majority of the core operating system API wrappers and helper functions.
/regex A regular expression library. Used in the query optimizer and execution to resolve expressions.
/scripts A set of shell script-based utilities.
/sql The main system code. You should start your exploration from this folder.
/sql-bench A set of benchmarking utilities.
/SSL A set of Secure Socket Layer utilities and definitions.
/storage The MySQL pluggable storage engine source code is located inside this folder. Also included is the storage engine example code. (See Chapter 7 for more details.)
/strings The core string handling wrappers. Use these for all of your string handling needs.
/support-files A set of preconfigured configuration files for compiling with different options.
/tests A set of test programs and test files.
/vio The network and socket layer code.
/zlib Data compression tools.


 


本文出自:億恩科技【www.laynepeng.cn】

服務器租用/服務器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質保障!--億恩科技[ENKJ.COM]

  • 您可能在找
  • 億恩北京公司:
  • 經營性ICP/ISP證:京B2-20150015
  • 億恩鄭州公司:
  • 經營性ICP/ISP/IDC證:豫B1.B2-20060070
  • 億恩南昌公司:
  • 經營性ICP/ISP證:贛B2-20080012
  • 服務器/云主機 24小時售后服務電話:0371-60135900
  • 虛擬主機/智能建站 24小時售后服務電話:0371-60135900
  • 專注服務器托管17年
    掃掃關注-微信公眾號
    0371-60135900
    Copyright© 1999-2019 ENKJ All Rights Reserved 億恩科技 版權所有  地址:鄭州市高新區翠竹街1號總部企業基地億恩大廈  法律顧問:河南亞太人律師事務所郝建鋒、杜慧月律師   京公網安備41019702002023號
      0
     
     
     
     

    0371-60135900
    7*24小時客服服務熱線