Download this Manual
EPUB - 0.8Mb

MySQL Internals Manual  /  Replication  /  Source Code Files

18.2 Source Code Files

Status of this section: up to date 2009-12-16

Files in the sql directory:




Contains the slave IO and SQL threads. This is the high-level administrative logic for the slave threads - that is, not the low-level functions for parsing the dump from the net, parsing the relay log, formatting the relay log, or executing events. Also contains the code to execute SHOW SLAVE STATUS.


The high-level binary logging mechanism for organizing events into a sequence so that it becomes a binary log. Routines for creating, writing, and deleting binary log files. Also the handler callbacks for the binlog.


The Log_event class and subclasses, for creating, writing, reading, printing, and applying events of every event type. Reading and writing here is at a low level, that is, serializing values into records.


Contains classes to read and execute old versions of the row log events.


Implementation of the data structure Relay_log_info that holds the state of the SQL thread, and also some auxiliary methods used by the slave SQL thread. (The slave SQL thread is in and it also uses other auxiliary functions.)


Contains the data structure Master_info that holds some state of the IO thread (the IO thread is in and it also uses other auxiliary functions).

The dump thread, where the master sends its binary log to the slave. This is also where the code resides for RESET SLAVE, CHANGE MASTER, RESET MASTER, SHOW BINLOG EVENTS, SHOW MASTER STATUS, SHOW BINARY LOGS, PURGE BINARY LOGS, as well as some replication-related system variables.

Contains code to execute BINLOG statements (that is, the base64-encoded things that mysqlbinlog prints when it sees row events).


Utilities for encoding and decoding table rows into and out of the row event format.


Utilities to initialize and register slaves on the master. Also unfinished and unused code dealing with "failsafe" (master election if the primary master fails).


Observer class declarations, which together constitute the binary log interface.


Enumeration of incidents (events that occur during replication). Also some constants that are local to the replication code.


Implements the table and database filters used by the --{binlog,replicate}-{do,ignore}-db, --replicate[-wild]-{do,ignore}-table, and --replicate-rewrite-db flags.


Coordination classes used by plugins to register to the binary log interface.


The injector class that allows external insertions into the binary log. This is used for cluster replication binary logging.


Utilities for reporting replication conditions and reporting errors, warnings, and informational messages on the slave.


Utilities to generate a mapping from numbers to tables. The mapping is used by the row logging system to identify tables.


Auxiliary classes and functions used for Table_map_events, and also an auxiliary class for smart pointers.

Prior to Bug#39934, the function decide_logging_format() that determines if statements should be written row-based or statement-based to the binlog. After Bug#39934, there is nothing related to replication here.

The function binlog_query(), called from commands that need to log a query_log_event. After Bug#39934, also decide_logging_format().


List of all types of unsafe statements, and functions for marking statements unsafe.

Files in the client directory:



The mysqlbinlog program. This file mainly contains a loop that calls auxiliary functions (members of Log_event defined in that read and print events.

Files in the plugin/semisync directory:




Auxiliary code, particularly for tracing, that is used by both the master semisync module and the slave semisync module.


The master semisync module.

The callbacks invoked by the server to use the master semisync module, as well as code to register the master semisync module.


The slave semisync module.

The callbacks invoked by the server to use the slave semisync module, as well as code to register the master semisync module.

Download this Manual
EPUB - 0.8Mb
User Comments
Sign Up Login You must be logged in to post a comment.