Status of this subsection: In progress 2009-10-21
What does the term correct replication really mean? To clarify the notion, we make the following preliminiary definitions:
-
(D-identical-environments) Two environments are identical if all the following are identical:
The hardware representation of floating point numbers and the hardware implementation of floating point arithmetic
The case sensitivity of the file systems
The versions of all used components of MySQL
-
Note: The following are examples of things not taken into account by this definition:
The hardware's word size, as long as it is supported by MySQL
The hardware's endianness
-
(D-identical-server-states) Two server states are identical if all the following are identical:
The sets of databases (a.k.a. schemas)
The table definitions (including table names, table options, column definitions) of all tables outside the mysql and information_schema databases
The table contents, modulo row order (in mathematical language: the unordered multisets of rows are equal), of all tables outside the mysql and information_schema databases
The definitions of all functions, procedures, triggers, views, prepared statements, and events
-
Note: The following are examples of things not taken into account in this definition:
System variables and user variables
The state of clients, including the replication slave. The state includes session variables and temporary tables.
Binlog files, relay log files, binlog indexes, relay log indexes
The internal state of the random number generator
Which plugins are installed
-
TODO: Question:
Should user privileges count as server state?
-
(D-rpl-correct) Replication is correct if both the following hold:
Any change on the master eventually results in the same change on the slave.
Any intermediate state of the slave is identical to some intermediate state of the master.
Note: it is not required that each intermediate state of the master is identical to some intermediate state of the slave.
We now state the architectural principles that define when replication shall be correct. The following is the main rule:
(P-rpl-correct) If a replication master and slave reside on identical environments (D-identical-environments) and the server states are identical (D-identical-server-states), and @@client.binlog_format!=STATEMENT, then replication shall be correct.