2807
Chapter 21. Extending MySQL
Table of Contents
21.1. MySQL Internals ............................................................................................................. 2807
21.1.1. MySQL Threads ................................................................................................... 2807
21.1.2. The MySQL Test Suite ......................................................................................... 2808
21.2. Adding New Functions to MySQL .................................................................................... 2808
21.2.1. Features of the User-Defined Function Interface .................................................... 2809
21.2.2. Adding a New User-Defined Function ................................................................... 2809
21.2.3. Adding a New Native Function ............................................................................. 2819
21.3. Debugging and Porting MySQL ....................................................................................... 2820
21.3.1. Debugging a MySQL Server ................................................................................. 2821
21.3.2. Debugging a MySQL Client .................................................................................. 2827
21.3.3. The DBUG Package ............................................................................................ 2827
21.1. MySQL Internals
This chapter describes a lot of things that you need to know when working on the MySQL code. To
track or contribute to MySQL development, follow the instructions in
Section 2.17.2, “Installing MySQL
from a Development Source Tree”
. If you are interested in MySQL internals, you should also subscribe
to our
internals
mailing list. This list has relatively low traffic. For details on how to subscribe, please
see
Section 1.6.1, “MySQL Mailing Lists”
. Many MySQL developers at Oracle Corporation are on the
internals
list and we help other people who are working on the MySQL code. Feel free to use this
list both to ask questions about the code and to send patches that you would like to contribute to the
MySQL project!
21.1.1. MySQL Threads
The MySQL server creates the following threads:
• Connection manager threads handle client connection requests on the network interfaces that
the server listens to. On all platforms, one manager thread handles TCP/IP connection requests.
On Unix, this manager thread also handles Unix socket file connection requests. On Windows, a
manager thread handles shared-memory connection requests, and another handles named-pipe
connection requests. The server does not create threads to handle interfaces that it does not listen
to. For example, a Windows server that does not have support for named-pipe connections enabled
does not create a thread to handle them.
• Connection manager threads associate each client connection with a thread dedicated to it that
handles authentication and request processing for that connection. Manager threads create a new
thread when necessary but try to avoid doing so by consulting the thread cache first to see whether
it contains a thread that can be used for the connection. When a connection ends, its thread is
returned to the thread cache if the cache is not full.
For information about tuning the parameters that control thread resources, see
Section 8.9.3, “How
MySQL Uses Threads for Client Connections”
.
• On a master replication server, connections from slave servers are handled like client connections:
There is one thread per connected slave.
• On a slave replication server, an I/O thread is started to connect to the master server and read
updates from it. An SQL thread is started to apply updates read from the master. These two threads
run independently and can be started and stopped independently.
• A signal thread handles all signals. This thread also normally handles alarms and calls
process_alarm()
to force timeouts on connections that have been idle too long.
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...