mysql目录结构

整理了mysql源代码目录结构。

一 MYSQL系统结构



二MYSQL目录结构

/bdb :The Berkeley DB storage engine handler implementation files

/BUILD :Program compilation files

/client :The mysql command tool (client program) implementation files

/data :The mysql database (system database) schema, data, and index files

/dbug :Debugging utility code

/heap :The MEMORY storage engine handler implementation files

/Docs :The documentation, both internal developer documents and the MySQL online manual

/include :Core system header files and type definitions

/innobase :The InnoDB storage engine handler implementation files

/isam :The old ISAM storage engine handler implementation files

/libmysql :The MySQL C client API (all C source and header files)

/libmysqld :The MySQL server core library (C, C++, and some header files)

/myisam :The MyISAM storage engine handler implementation files

/myisammrg :The MyISAM Merge storage engine handler implementation files

/mysys :The core function library, with basic low-level functions

/regrex :The regular expression function library

/scripts :Shell scripts for common utilities

/sql :The meat of the server's implementation, with core classes and implementations

/sql-bench :MySQL benchmarking shell scripts

/strings :Lower-level string-handling functions

/support-files :Preconfigured MySQL configuration files (such as my-huge. cnf)

/tests :Test programs and scripts

/vio :Network/socket utility functions, virtual I/O, SSL, and so on

/zlib :Compression function source files

/extra :Code of miscellaneous tools

/libmysql_r :Thread-safe version of the client library

/man :Unix manpages

/ndb :MySQL Cluster code,utility scripts,and documentation,Moved to the storage directory in

5.1

/netware :Files used by the Netware port

/OS2 :Files used by the OS/2 port

/pstack :Code for the pstack library that allows the executable to unwind and resolve its own

stack.Useful in a segmentation fault signal handler

/strings :Low-level string and memory manipulation functions,and some data type definitions


/Docs目录下包含以下主题内容:

1. 编码向导
2. 优化器
3. 重要的算法及结构
4. 字符集和相关内容
5. Mysql如何执行不同的select操作
6. Mysql如何处理请求
7. 通信协议
8. 同步
9. MyISAM记录结构
10. .myi文件结构
11. InnoDB记录结构
12. InnoDB页面结构


重要的5个目录

(1)/BUILD下可以编译链接

a) BUILD/compile-pentium-debug –prefix=$HOME/mysql-bin

b) make

c) make install

d) make install

e) $HOME/mysql-bin/bin/mysql-install-db –basedir=$HOME/mysql-bin \

–datadir=$HOME/mysql-bin/var

Ps:如果编译产生问题list.mysql.com搜索“build”

可以使用图形化工具调试Graphical debugger tool(DDD)

http://www.gnu.org/software/ddd/manual/


(2)/myisam目录中以mi开头的文件代表了myisam

mi_open.c 表示open操作

mi_close.c 表示close操作

mi_rkey.c 表示随机key search

mi_rnext.c 表示next key search

mi_key.c 表示managing keys

Ps:inserting rows操作对应mi_write.c,并不是mi_insert.c。

在myisam目录中能找到处理文件,行和key的程序,但不能找到处理列的程序。


(3)/mysys目录 5.0.45中有150个c文件

array.c 动态数组函数定义。

hash.c/.h Hash表函数定义

mf_qsort.c 快速排序算法定义

my_alloc.c 内存分配程序

mf_pack.c 文件和目录处理程序

chartset.c 字符集处理程序


(4)/sql目录中有4种处理程序

“parser”: sql_lex.cc

sql_yacc.cc

“handler”: ha_berkeley.cc

ha_heap.cc

ha_myisam.cc

“statement”: sql_delete.cc

sql_do.cc

sql_help.cc

sql_insert.cc

“statement function”: sql_string.cc

sql_olap.cc

sql_udf.cc

Ps:ha开头的程序是一个处理接口,为不同的storage engine服务,比如ha_myisam.cc就是给myisam调用。

sql开头的程序即为SQL Command。


(5)/vio 即为virtual I/O




Open-source目录

(1)dbug

(2)pstack

(3)regex

(4)strings

(5)zlib


内置和可扩展的存储引擎目录

(1)bdb (可扩展的)

(2)heap

(3)innobase(可扩展的)

(4)myisam

(5)myisammrg

(6)ndb


特定系统平台

(1)OS/2

(2)win

(3)netware


1 Comment 发表评论