Mysql 体系结构系列之九

前言:参考Mysql体系结构系列之八:细看核心模块

http://blog.csdn.net/nature_ann/article/details/10108433

1. 细看核心模块 Detailed Look at the Core Modules

1.1 Access Control Module 访问控制模块

<<---第一,访问控制模块:verfies clent user -sql/sql_acl.cc----->>

The Access Control Module verifies that the client user has sufficient privileges to

perform the requested operation.

访问控制模块检验客户端用户是否有足够的权限来执行所请求的操作。

 

Most of the code is in sql/sql_acl.cc. However, one of the most frequently used functions,check_access( ), is found in sql/sql_parse.cc.

大部分代码都位于sql/sq._acl.cc中,但是最常用的函数之一check_access( )则位于sql/sql_parse.cc中。

 

Some other functions of interest follow, all located in sql/sql_acl.cc unless otherwise

indicated:

除非有另外的说明,否则其他部分的有关函数均位于sql/sql_acl.cc中。

>>check_grant( )

>>check_table_access( ) in sql/sql_parse.cc

>>check_grant_column( )

>>acl_get( )

 

The code itself has not changed very much since version 3.22. However, new privilege typeswere added in version 4.0, which somewhat changed the way this module was used by the rest of the code.

从3.22版本开始,代码本身变化不大。但是在4.0版本中,增加了新的权限类型,这多少改变了其余代码使用这一模块的方式。

 

MySQL developers are planning to add support for roles, which will require significant changes to this module.

Mysql开发人员计划为各种角色增加支持,这将要求对该模块进行重大更改。

1.2 Parser 解析器

<<---第二,解析器:parsing queries and parse tree-- sql/sql_parse.cc----->>

The Parser is responsible for parsing queries and generating aparse tree.

解析器负责解析查询,并生成解析树。

 

The entry point is mysql_parse( ) insql/sql_parse.cc,

which performs some initializations and then invokes yyparse( ), a function in sql/sql_yacc.cc generated by GNU Bison from sql/sql_yacc.yy,

which contains the definition of the SQL language subsetunderstood by MySQL.

入口点是sql/sql_parse.cc中的mysql_parse(),该函数负责执行某些初始化,然后调用yyparse()----这是sql/sql_yacc.cc中的一个函数,是由sql/sql_yacc.yy中的GNU Bison生成,包含能被mysql理解的SQL语言子集的定义。

 

Note that unlike many open source projects, MySQL has its own generated lexical scannerinstead of using lex.

注意,与许多的开源项目不同,Mysql不使用lex,而是拥有自己生成的句法扫描器。

 

The MySQL lexical scanner is discussed in detail in Chapter 9. Some files of interest, in addition to the ones just mentioned, include:

Mysql句法扫描器将在第9章中详细讨论。除了刚才提到的几个文件,其他的一些有关文件包括:

>>sql/gen_lex_hash.cc

>>sql/lex.h

>>sql/lex_symbol.h

>>sql/lex_hash.h (generated file)

>>sql/sql_lex.h

>>sql/sql_lex.cc

>>The group of files under sql/ with names starting in item_ and extensions of .h or .cc

 

As the new SQL features are added, the parser keeps changing to accommodate

them.

随着SQL新功能的增加,解析器不断更改,以便使用这些新功能。

 

However, the core structure of the parser is fairly stable, and so far has been

able to accommodate the growth.

不过,解析器的核心结构相当的稳定,迄今为止还能够适应这种发展。

 

It is reasonable to expect that while some elements will be added on, the core will not be changedvery much for some time.

我们又理由相信,尽管将会增加一些元素,但是在一定时间内核心却不会大幅度的改变。

 

MySQL developers have been, and sometimes still are,talking about a core rewrite of the parser and moving it away from yacc/Bison to make it faster.

Mysql开发人员经常谈起想要重新写解析器的核心,并将它从yacc/Bison中删除,以便提高速度。

 

However, they have been talking about it for at least seven years already, and this has not yet become a priority.

可是他们讨论这事至少已经七年了,仍然没有具体实施。

1.3 Command Dispatcher 命令调度器

<<---第三,命令调度器:requests to lower-level-modules-----sql/sql_parse.cc---------->>

The Command Dispatcher isresponsible for directing requests to the lower-level

modules that will know how to resolve them.

命令调度器负责将请求转发给,那些知道如何处理这些请求的较低层次模块。

 

It consists of two functions in sql/sql_parse.cc:do_command( ) and dispatch_command( ).

它包括sql/sql_parse.cc中的两个函数:do_command() dispatch_command().

 

The module kept growing over time as the set of supported commands increased.

Small growth is expected in the future, but the core structure is unlikely to change.

随着时间的推移和所支持命令的增多,模块不断发展,预测将来还会有小幅度的发展,但是不可能改变核心结构。

1.4 Query Cache Module 查询高速缓存模块

<<---第四,查询高速缓存模块:caches query results—short-circuit---sql/sql_cache.cc  ---------->>

The Query Cache Module caches query results, and tries to short-circuit the execution of queries by delivering the cached result whenever possible.

查询高速缓存模块:高速缓存查询结果。在有可能的时候通过提交高速缓存结果,试图尝试短路查询的执行。

 

It is implemented in sql/sql_cache.cc. Some methods of interest include:

该模块在sql/sql_cache.cc中实现。有关方法包括:

>>Query_cache::store_query( )

>>Query_cache::send_result_to_client( )

 

The module was added in version 4.0. Few changes aside from bug fixes are expected in the future.

4.0版本中已经增加了这个模块。以后除了漏洞修复,几乎不会进行改动。

 

待续。。。

 

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值