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

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

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

1.1 Client/Server Protocol API 客户端/服务器协议API

<<---client/server communication protocol-- operating system--Protocol-APIcreate|read|interpret|send the protocol packets--sql/protocol.cc &&sql/protocol.h&&sql/net_serv.cc ----->>

TheMySQL client/server communication protocol sits on top of theoperating system

protocol (TCP/IP or local socket) in theprotocol stack.

Mysql客户端/服务器通信协议为协议栈中的操作系统协议(TCP/IP或本地套接字)之首。

This module implements theAPI used across the server to create, read, interpret, andsend the protocol packets. The code is found in sql/protocol.cc,sql/protocol.h, and sql/net_serv.cc.

这一模块实现在整个服务器中使用的API,以创建、读取、解释和发送协议包。其代码位于sql/protocol.cc, sql/protocol.h和sql/net_serv.cc中。

The files sql/protocol.hand sql/protocol.cc define and implement a hierarchy of classes.Protocol is the base class, andProtocol_simple, Protocol_prep, andProtocol_cursor are derived from it.

文件sql/protocol.h和sql/protocol.cc定义并实现了一个类的体系结构。Protocol为基类,由此派生出Protocol_simple, Protocol_prep及Protocol_cursor。

Some functions of interest in this module are:

>>my_net_read( ) in sql/net_serv.cc

>>my_net_write( ) in sql/net_serv.cc

>>net_store_data( ) in sql/protocol.cc

>>send_ok( ) in sql/protocol.cc

>>send_error( ) in sql/protocol.cc

本模块的一些有关函数如下:my_net_read( )中的sql/net_serv.cc,

my_net_write( )中的sql/net_serv.cc,

net_store_data( )中的sql/protocol.cc,

send_ok( )中的sql/protocol.cc,

send_error( )中的sql/protocol.cc.

In version 4.0 the protocol was changed to support packets up to 4 GB in size. Prior

to that, the limit was24 MB. The Protocol class hierarchy was added in version 4.1

to deal with prepared statements.

在4.0版本中,该协议改为支持高达4GB的数据包。在此之前,限值为24MB。

在4.1版本中增加了协议类体系结构,用于处理预处理语句。

It appears that at this point most of theproblematic areas in the protocol at this level have beenaddressed, and it is reasonable to expect that this code will not be changing much in the near future.

目前,在改层次上,协议中的大部分问题都已经获得解决。我们又理由预测,这部分代码以后不会发生大的变化。

However,MySQL developers are thinking about addingsupport for notifications.

不过,Mysql开发人员正在考虑增加对通知的支持。

1.2 Low-Level Network I/O API 低层次网络I/O API

<<--- Low-Level Network I/O API--vio/directory-- ----->>

TheLow-Level Network I/O API provides an abstraction for the low-level network I/Oand SSL sessions. The code is found in the vio/ directory.

低层次网络I/O API 提供了低层次网络I/O 和SSL会话的抽象。代码在vio目录下面。

All functions in this module have names starting withvio_.

本模块的所有函数名称均以vio_开头。

This module was introduced in 3.23, spurred by the need to supportSSL connections.

Abstracting the low-level network I/O also facilitated porting to new platforms and maintaining the old ports.

本模块在3.23版本中引入,源于支持SSL连接的需要。抽象低层次网络I/O还有利于移植到新平台及维护旧端口。

1.3 Core API 核心API

<<--- Core APIportable--file I/O| memory management |string manipulation |filesystem navigation |formatted printing | a rich collection of data structures | algorithms etc…----->>

The Core API is the Swiss Army knife of MySQL. It provides functionality for portable file I/O,memory management, string manipulation,filesystem navigation, formatted printing,a rich collection of data structures and algorithms, and a number of other things.

核心APIMysql的瑞士军刀。它提供了用于可移植的文件I/O、内存管理、字符串操、文件系统导航、格式化打印、丰富的数据结构和算法集,以及其他的许多功能。

If a problem ever arises, there is usually a solution for it in the Core API Module. If there is not, it will be coded up. This module is to a great extent an expression of Monty’s ability and determination to never solve just one problem.

只要出现问题,核心API模块中总有方法解决问题。如果不能,则可以通过编码解决。这个模块在很大程度上体现了Monty的才干和不仅仅是解决一个问题的决心。

It is perhaps the core component of the Miracle of MySQL.

The code is found in the mysys/and strings/ directories. Many of the core API functions have names starting withmy_.

这可能就是Mysql称得上奇迹的核心组件。

代码位于mysysstrings目录下。许多核心API函数的名字都以my_开头。

The module has always been in a state of growth and improvement. As the new functionality is added, great care is put into preserving itsstability and high level of performance.

本模块一直处于发展、改进状态。随着新功能的增加,稳定性和性能的优越性大受关注。

It is reasonable to expect that this pattern will continue in the future.

我们有理由期待这一模式将在未来继续发展。

 

At this point, detailed look at the core modules is end.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐