17.1.2.3. Safe and Unsafe Statements for Row-Based Logging and Replication

When speaking of the “safeness” of a statement in MySQL Replication, we are referring to whether a statement and its effects can be replicated correctly using statement-based format. If this is true of the statement, we refer to the statement as safe; otherwise, we refer to it as unsafe.

In general, a statement is safe if it deterministic, and unsafe if it is not. However, certain nondeterministic functions are not considered unsafe (see Nondeterministic functions not considered unsafe, later in this section). In addition, statements using results from floating-point math functions—which are hardware-dependent—are always considered safe (see Section 17.4.1.9, “Replication and Floating-Point Values”).

Handling of safe and unsafe statements.  A statement is treated differently depending on whether the statement is considered safe, and with respect to the binary logging format (that is, the current value of binlog_format).

  • No distinction is made in the treatment of safe and unsafe statements when the binary logging mode is ROW.

  • If the binary logging format is MIXED, statements flagged as unsafe are logged using the row-based format; statements regarded as safe are logged using the statement-based format.

  • If the binary logging format is STATEMENT, statements flagged as being unsafe generate a warning to this effect. (Safe statements are logged normally.)

For more information, see Section 17.1.2, “Replication Formats”.

Statements considered unsafe.  Statements having the following characteristics are considered unsafe:

For additional information, see Section 17.4.1, “Replication Features and Issues”.

Copyright © 2010-2024 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout