innodb的几个模块文件夹

来源:互联网 发布:java帮助文档中文版 编辑:程序博客网 时间:2024/06/08 19:24

摘录自:http://forge.mysql.com/wiki/MySQL_Internals_Files_In_InnoDB_Sources

根据mysql5.5.18略有调整

\btr(B-TREE)

  File Name  What Name Stands For          Comment Inside File

  ---------  --------------------         -------------------

  btr0btr.c  B-tree / B-tree                    B-tree

  btr0cur.c  B-tree / Cursor                 index tree cursor

  btr0sea.c  B-tree / Search                 index tree adaptive search

  btr0pcur.c B-tree / persistent cursor      index tree persistent cursor

\buf(BUFFERING)

  File Name  What Name Stands For                Comment Inside File

  ---------  --------------------               -------------------

  buf0buf.c   Buffering / Buffering             The database buffer buf_pool

  buf0flu.c   Buffering / Flush                 flush algorithm

  buf0lru.c   least-recently-used               replacement algorithm

  buf0rea.c   Buffering / read                  read

  buf0buddy.c buffering/buddy                   Binarybuddy allocator for compressed pages

\data(DATA)

  File Name  What Name Stands For        Comment Inside File

  ---------  --------------------        -------------------

  data0data.c Data / Data                  SQL data field and tuple

  data0type.c Data / Type                  Data types

\dict(DICTIONARY)

  File Name          What Name Stands For     Comment Inside File

  ---------        --------------------    -------------------

  dict0dict.c        Dictionary / Dictionary   Datadictionary system

  dict0boot.c          Dictionary / boot              booting

  dict0crea.c        Dictionary / Create           creation

  dict0load.c        Dictionary / load          loadto memory cache

  dict0mem.c       Dictionary / memory       memoryobject creation

\dyn(DYNAMICALLY ALLOCATED ARRAY)

  File Name  What Name Stands For     Comment Inside File

  ---------  --------------------    -------------------

  dyn0dyn.c  Dynamic / Dynamic          dynamically allocated array

该文件只保护一个函数:dyn_array_add_block,用于向一个动态分配的数组中增加一个块,innodb可能会使用这样的数组来控制线程间的并发性

\eval(EVALUATING)

  File Name      What Name Stands For              Comment Inside File

  ---------      --------------------            -------------------

  eval0eval.c      Evaluating/Evaluating            SQL evaluator

  eval0proc.c     Evaluating/Procedures           Executes SQL procedures

\fil(FILE)

  File Name  What Name Stands For         Comment Inside File

  ---------  --------------------         -------------------

  fil0fil.c  File / File                Thelow-level file system

\fsp(FILE SPACE)

  File Name  What Name Stands For      Comment Inside File

  ---------  --------------------      -------------------

  fsp0fsp.c  File Space Management     File space management

可以找到一些文件file space的文件结构的描述和注释;例如extend的描述,也可以找到空闲page链是如何被维护的。

\fut(FILE UTILITY)

  File Name  What Name Stands For        Comment Inside File

  ---------  --------------------      -------------------

  fut0fut.c  File Utility / Utility     File-based utilities

  fut0lst.c  File Utility / List       File-based list utilities

影响文件层的链表结构

\ha(HASHING)

  File Name         What Name Stands For       Comment Inside File

  ---------          --------------------     -------------------

  ha0ha.c               Hashing / Hashing        Hash table with external chains

  hash0hash.c            Hashing / Hashing          Simple hash table utility

  ha0storage.c           hashing/storage          Provides a data structure that storeschunks of data in  its own storage,avoiding duplicates.

创建/维护哈希表的底层实现

\ibuf(INSERT BUFFER)

  File Name  What Name Stands For       CommentInside File

  ---------  --------------------   -------------------

  ibuf0ibuf.c Insert Buffer /        Insert buffer

\include(INCLUDE)

All.h and .ic files are in the \include directory. It's habitual to put commentsalong with the descriptions, so if (for example) you want to see comments aboutoperating system file activity, the place to look is \include\os0file.h.

\lock(LOCKING)

  File Name  What Name Stands For         Comment Inside File

  ---------  --------------------         -------------------

  lock0lock.c  Lock / Lock               Thetransaction lock system

  lock0iter.c lock iterater              Lock queue iterator. Can iterate over tableand record lock queues.

\log(LOGGING)

  File Name  What Name Stands For        Comment Inside File

  ---------  --------------------     -------------------

  log0log.c  Logging / Logging          Database log

  log0recv.c Logging / Recovery         Recovery

\mach(MACHINE FORMAT)

  File Name  What Name Stands For       Comment Inside File

  ---------  --------------------    -------------------

  mach0data.c Machine/Data             Utilities for converting

Utilitiesfor converting data from the database file to the machine format.

\mem(MEMORY)

  File Name  What Name Stands For        Comment Inside File

  ---------  --------------------      -------------------

  mem0mem.c  Memory / Memory          The memory management

  mem0dbg.c  Memory / Debug           ... the debug code

  mem0pool.c Memory / Pool            ...the lowest level

Innodb内存管理模块,在innodb里包含3种类型的pool:bufferpool(\buf)、log pool(\log) 和commonpool

\mtr(MINI-TRANSACTION)

  File Name  What Name Stands For         Comment Inside File

  ---------  --------------------         -------------------

  mtr0mtr.c  Mini-transaction /          Mini-transaction buffer

  mtr0log.c  Mini-transaction / Log      Mini-transaction log routines

minitransaction的一些函数实现,这里的函数在innodb的其他模块会被频繁调用到

\os(OPERATING SYSTEM)

  File Name  What Name Stands For         Comment Inside File

  ---------  --------------------      -------------------

  os0file.c  OS / File                   Toi/o primitives

  os0thread.c OS / Thread                 To thread control primitives

  os0proc.c  OS / Process                Toprocess control primitives

  os0sync.c  OS / Synchronization        Tosynchronization primitives

\page(PAGE)

  File Name  What Name Stands For       Comment Inside File

  ---------  --------------------     -------------------

  page0page.c Page / Page               Index page routines

  page0cur.c Page / Cursor              Thepage cursor

page0zip.c  Page/zip                   Compressed page interface

\pars(PARSING)

  File Name  What Name Stands For        Comment Inside File

  ---------  --------------------     -------------------

  pars0pars.c Parsing/Parsing               SQL parser

  pars0grm.c Parsing/Grammar               A Bison parser

  pars0opt.c Parsing/Optimizer           Simple SQL Optimizer

  pars0sym.c Parsing/Symbol Table       SQLparser symbol table

  lexyy.c    Parsing/Lexer                Lexical scanner

语法解析器和优化器,将输入的SQL字符串解析成语法解析树,并传递给评估(\eval)程序使用,但作为一个存储引擎,语法解析工作在mysql层已经完成,因此这个文件夹并不重要。

\que(QUERY GRAPH)

  File Name  What Name Stands For          Comment Inside File

  ---------  --------------------       -------------------

  que0que.c  Query Graph / Query           Query graph

看起来像是通过查询计划图决定执行分支

\read(READ)

  File Name  What Name Stands For       Comment Inside File

  ---------  --------------------      -------------------

  read0read.c Read / Read                   Cursor read

与多版本控制结构体read_view的创建/关闭等操作相关的函数

\rem(RECORD MANAGER)

  File Name  What Name Stands For       Comment Inside File

  ---------  --------------------      -------------------

  rem0rec.c  Record Manager                 Record Manager

  rem0cmp.c  Record Manager /Comparison     Comparison services for records

             

\row(ROW)

  File Name  What Name Stands For          Comment Inside File

  ---------  --------------------        -------------------

  Row0ext.c  Row/ externally              Caching of externally storedcolumn prefixes

  Row0merge.c Row/merge                    Newindex creation routines using a merge sort

row0row.c   Row / Row                   General row routines

  row0uins.c Row / Undo Insert            Fresh insert undo

  row0umod.c Row / Undo Modify          Undo modify of a row

  row0undo.c Row / Undo                     Row undo

  row0vers.c Row / Version                Row versions

  row0mysql.c Row / MySQL                Interfacebetween Innobase row operations and MySQL. Contains also create table and other data dictionaryoperations.

  row0ins.c  Row / Insert               Insert into a table

  row0sel.c  Row / Select                    Select

  row0upd.c  Row / Update                Update of a row

  row0purge.c Row / Purge               Purgeobsolete records

与行数据相关的操作,包括mysql/innodb层行记录数据的转换

\srv(Server)

  File Name  What Name Stands For         Comment Inside File

  ---------  --------------------        -------------------

  srv0srv.c  Server / Server              Server main program

  srv0start.c Server / Start               Startsthe InnoDB database server

innodb的后台线程在这里被启动

\sync(SYNCHRONIZATION)

  File Name  What Name Stands For       Comment Inside File

  ---------  --------------------     -------------------

  sync0sync.c Synchronization /         Mutex,the basic sync primitive

  sync0arr.c ... / array               Wait array used in primitives

  sync0rw.c  ... / read-write          read-write lock for thread sync

负责线程同步、互斥、读写锁等模块

\trx(Transaction)

  File Name  What Name Stands For          Comment Inside File

  ---------  --------------------           -------------------

  Trx0i_s.c  transaction/information_schema  innodb_trx,innodb_locks and innodb_lock_waits tables fetch code

trx0trx.c   Transaction /                 The transaction

  trx0purge.c Transaction / Purge            ... Purge old versions

  trx0rec.c  Transaction / Record           ... Undo log record

  trx0roll.c / Rollback                     ...Rollback

  trx0sys.c  Transaction / System           ...System

  trx0rseg.c / Rollback segment             ...Rollback segment

  trx0undo.c Transaction / Undo             ... Undo log

\usr(USER)

  File Name  What Name Stands For         Comment Inside File

  ---------  --------------------        -----------------

  usr0sess.c User / Session                Sessions

打开/关闭跟session相关的结构体sess_open和sess_close

\ut(UTILITIES)

  File Name  What Name Stands For          Comment Inside File

  ---------  --------------------        -------------------

  Ut0list.c  utilities/list              Adouble-linked list

  Ut0vec.c    utilities/vector           A vector of pointers to data items

  ut0rbt.c   utilities/ Red-Black tree   Red-Black tree implementation

  Ut0bh.c    utilities/ Binary heap        Binary min-heap implementation.

  ut0ut.c    Utilities / Utilities        Various utilities

  ut0byte.c  Utilities / Debug            Utilitiesfor byte operations(ut0byte.ic)

  ut0rnd.c   Utilities / Random           Random numbers and hashing

  ut0mem.c   Utilities / Memory           Memory primitives

  ut0dbg.c   Utilities / Debug            Debug utilities

 

 

原创粉丝点击