bazaar annotate – 快速找到引入代码的版本

研读MySQL代码时,常常会碰到一些代码不符合自己的思维逻辑,或者根本弄不明白。
这时就需要有更多的历史信息来帮助我们理解代码。一个很有效的方法是,利用
bazaar annotate来找到引入该代码的revision,以及相关的历史信息。

例如,我想知道,是哪个revision引入了此函数,为什么要引入这个函数。

  1. bool sqlcom_can_generate_row_events(const THD *thd)
  2. {
  3.   return (sql_command_flags[thd->lex->sql_command] &
  4.           CF_CAN_GENERATE_ROW_EVENTS);
  5. }

通过 bzr annoate 来查找引入此代码的revision

MySQL Code Primer Step IV – Important Elements Of MySQL Source Code

MySQL server project not only includes source code for the server binary, but also includes some essential tools for installation, maintenance, access and test. Their source code are packed in different directories depend on their utilities.

* Server Source Code
Server code is divided into SQL and Engine parts.

- SQL Part
This part includes the source code for
@ Setting up the server and providing service to users.
@ Parsing SQL statements and then calling engine API to manipulate the data stored
in different engines. The API is defined by SQL Part and implemented by engines.
@ Other features that is not related to engines, e.g. Replication.

MySQL Code Primer Step III – Trick Of Running MySQL Server

As developers, we often need to check some problems or features with various MySQL options, or check them on a few different versions. So we need to change MySQL’s config file often and run many MySQL servers of different versions at the same machines. That is very boring and inconvenient. Fortunately , we have ‘MySQL Test’ platform which can do the boring job for us and make the work simple.

* Running MySQL Test Cases

MySQL test platform and its test cases are in ‘mysql-test’ directory.