国产福利在线播放|久久精品福利网站免费|国产呻吟视频在线观看|日韩一区二区三区免费高清|久996视频精品免费观看|欧美日本在线一区二区三区|在线最新无码经典无码免費資訊|国产午夜亚洲精品国产成人最大

始創(chuàng)于2000年 股票代碼:831685
咨詢(xún)熱線(xiàn):0371-60135900 注冊(cè)有禮 登錄
  • 掛牌上市企業(yè)
  • 60秒人工響應(yīng)
  • 99.99%連通率
  • 7*24h人工
  • 故障100倍補(bǔ)償
全部產(chǎn)品
您的位置: 網(wǎng)站首頁(yè) > 幫助中心>文章內(nèi)容

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

發(fā)布時(shí)間:  2012/9/3 17:16:02

代碼分析基于最新的5.5.21

Mysql服務(wù)器的main()在/sql/main.cc,實(shí)際的入口點(diǎn)在/sql/mysqld.cc。

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

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

(1)宏HAVE_NPTL:

這個(gè)宏如果打開(kāi)了會(huì)去讀一個(gè)系統(tǒng)變量LD_ASSUME_KERNEL,并把他賦給一個(gè)全局變量ld_assume_kernel_is_set,這個(gè)系統(tǒng)變量設(shè)置了系統(tǒng)線(xiàn)程的實(shí)現(xiàn)模型。linux內(nèi)核在2.6版本后,缺省的線(xiàn)程模型是NPTL。-
 


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

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

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

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

(2)EMBEDDED_LIBRARY

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

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

主要優(yōu)點(diǎn)在于,增加了速度,并使得嵌入式應(yīng)用程序的管理更簡(jiǎn)單。嵌入式服務(wù)器庫(kù)是以MySQL的客戶(hù)端/服務(wù)器版本為基礎(chǔ)的,采用C/C++語(yǔ)言編寫(xiě)。 其結(jié)果是嵌入式服務(wù)器也是用C/C++語(yǔ)言編寫(xiě)的。 在其他語(yǔ)言中,嵌入式服務(wù)器不可用。

這個(gè)宏可以通過(guò)CMake配置,

-DWITH_EMBEDDED_SERVER=1 打開(kāi)這個(gè)宏

在plug.cmake函數(shù)里有它的定義:

PROPERTIES COMPILE_DEFINITIONS "MYSQL_SERVER;EMBEDDED_LIBRARY")

整個(gè)代碼的流程如下:我們講分更細(xì)的文章詳細(xì)介紹每部分:

Mysql服務(wù)器監(jiān)聽(tīng):

 

Mysql 源代碼的目錄結(jié)構(gòu) :(以下來(lái)自官方文檔)

/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.riomediacenter.com】

服務(wù)器租用/服務(wù)器托管中國(guó)五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]

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

    0371-60135900
    7*24小時(shí)客服服務(wù)熱線(xiàn)