Binary Log Formats
5 stars based on
When running in MIXED logging format, the server automatically switches from statement-based to row-based logging under the following conditions:. When a function contains UUID. When the body of a view requires row-based replication, the statement creating the view also uses it.
For binlog_format statement mixed, this occurs when the statement creating a view uses the UUID function. If a statement is logged by row and the session that executed the statement has any temporary tables, logging by row is used for all subsequent statements except for those accessing temporary tables until all temporary tables in use by that session are dropped.
Temporary tables cannot be logged using row-based format; thus, once row-based logging is used, all subsequent statements using that table are unsafe. The server approximates this condition by treating all statements executed during the session as unsafe until the session no longer holds any temporary tables.
BugBug The following system variables, when used with session scope binlog_format statement mixeddo not cause the logging format to switch:. When one of the tables involved is a log table in the mysql database. A warning is generated if you try to execute a statement using statement-based logging that should be written using row-based logging.
However, only the first statement that generated the binlog_format statement mixed for each client session is written to the error binlog_format statement mixed to prevent flooding the log. In addition to the decisions above, individual engines can also determine the logging format binlog_format statement mixed when information in a table is updated. The logging capabilities of an individual engine can be defined as follows:. If an engine supports row-based logging, the engine is said to be row-logging capable.
If an engine supports statement-based logging, the engine is said to be statement-logging capable. A given storage engine can support either or both logging formats. The following table lists the formats supported by each engine.
Whether a statement is to be logged and the logging mode to be used is determined according to the type of statement safe, unsafe, or binary injectedthe binary logging format STATEMENTROWor MIXEDand the logging capabilities of the storage engine binlog_format statement mixed capable, row capable, both, or neither. Binary injection refers to logging a change that must be logged using ROW format. Statements may be logged binlog_format statement mixed or without a warning; failed statements are not logged, but generate errors in the log.
This is shown in the following decision table. The information is also written to the mysqld error log. Only one error for each error instance per client connection is logged to prevent flooding the log. The binlog_format statement mixed message includes the SQL statement that was attempted. If a slave server was started with --log-warnings enabled, the slave prints messages to the error log to provide information about its status, such as the binary log and relay log coordinates where it starts its job, when it is switching to another relay log, when it reconnects after binlog_format statement mixed disconnect, and so forth.
When a call to a UDF is involved. This is true whether or not any temporary tables are actually logged. Bug When a statement refers to one or more system variables. The following system variables, when used binlog_format statement mixed session scope binlog_format statement mixeddo not cause the logging format to switch: Binary logging is impossible since at least one engine is involved that is both row-incapable and statement-incapable.
Cannot execute row injection: Binary logging is not possible since at least one table uses a storage engine that is not capable of row-based logging.