19.2 Source Code Files

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

Files in thesqldirectory:

File

Description

slave.h/.cc

Contains the slaveIO 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 executeSHOW SLAVE STATUS.

log.h/.cc

The high-level binaryloggingmechanism 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.

log_event.h/.cc

TheLog_eventclass 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.

old_log_event.h/.cc

Contains classes to read and executeold versionsof the row log events.

rpl_rli.h/.cc

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

rpl_mi.h/.cc

Contains the data structureMaster_infothat holds some state of the IO thread (the IO thread is in slave.cc and it also uses other auxiliary functions).

sql_repl.cc

Thedump thread, where the master sends its binary log to the slave. This is also where the code resides forRESET SLAVE,改变马STER,RESET MASTER,SHOW BINLOG EVENTS,SHOW MASTER STATUS,SHOW BINARY LOGS,PURGE BINARY LOGS, as well as some replication-related system variables.

sql_binlog.cc

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

rpl_record.h/.cc

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

repl_failsafe.h/.cc

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

replication.h

Observer class declarations, which together constitute thebinary log interface.

rpl_constants.h

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

rpl_filter.h/.cc

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

rpl_handler.h/.cc

Coordination classes used bypluginsto register to the binary log interface.

rpl_injector.h/.cc

Theinjector classthat allows external insertions into the binary log. This is used for cluster replication binary logging.

rpl_reporting.h/.cc

Utilities for reporting replication conditions andreporting errors, warnings, and informational messageson the slave.

rpl_tblmap.h/.cc

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

rpl_utility.h/.cc

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

sql_base.cc

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

sql_class.cc

The functionbinlog_query(), called from commands that need to log a query_log_event. AfterBug#39934, alsodecide_logging_format().

sql_lex.h/.cc

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

Files in theclientdirectory:

File

Description

mysqlbinlog.cc

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

Files in theplugin/semisyncdirectory:

File

Description

semisync.h/.cc

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

semisync_master.h/.cc

The master semisync module.

semisync_master_plugin.cc

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

semisync_slave.h/.cc

The slave semisync module.

semisync_slave_plugin.cc

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