Author: shinz
Date: 2006-02-27 14:40:35 +0100 (Mon, 27 Feb 2006)
New Revision: 1446
Log:
Various edits to reflect the recent (5.1.7) changes around BINLOG_FORMAT
Modified:
trunk/refman-5.1/database-administration.xml
trunk/refman-5.1/replication.xml
Modified: trunk/refman-5.1/database-administration.xml
===================================================================
--- trunk/refman-5.1/database-administration.xml 2006-02-25 17:12:20 UTC (rev 1445)
+++ trunk/refman-5.1/database-administration.xml 2006-02-27 13:40:35 UTC (rev 1446)
@@ -3704,12 +3704,69 @@
<para>
The binary logging format, either
- <literal>STATEMENT</literal> or <literal>ROW</literal>.
- <literal>binlog_format</literal> is set by the
- <option>--binlog-format</option> option. See
- <xref linkend="replication-row-based"/>. This variable was
- added in MySQL 5.1.5.
+ <literal>STATEMENT</literal>, <literal>ROW</literal>, or
+ <literal>MIXED</literal>. <literal>binlog_format</literal>
+ is set by the <option>--binlog-format</option> option at
+ startup, or by the <literal>BINLOG_FORMAT</literal>
+ variable at runtime (you need the <literal>SUPER</literal>
+ privilege to set this globally). See
+ <xref linkend="replication-row-based"/>. The startup
+ variable was added in MySQL 5.1.5, and the runtime
+ variable in MySQL 5.1.7. <literal>MIXED</literal> was
+ added in MySQL 5.1.7.
</para>
+
+ <para>
+ <literal>STATEMENT</literal> is used by default. If
+ <literal>MIXED</literal> is specified, statement-based
+ replication is used, too, except for cases where only
+ row-based replication is guaranteed to lead to proper
+ results. For example, this is the case when statements
+ contain user-defined functions (UDF) or the
+ <literal>UUID()</literal> function. An exception to this
+ rule is that <literal>MIXED</literal> always uses
+ statement-based replication for stored functions and
+ triggers.
+ </para>
+
+ <para>
+ There are exceptions when you cannot switch the
+ replication format at runtime:
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ From within a stored function or a trigger.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ If <literal>NDB</literal> is enabled.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ If the session is currently in row-based replication
+ mode and has open temporary tables.
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ Trying to switch the format in those cases results in an
+ error.
+ </para>
+
+ <para>
+ Before MySQL 5.1.7, switching to row-based replication
+ format would implicitly set
+ <option>--log-bin-trust-function-creators=1</option> and
+ <option>--innodb_locks_unsafe_for_binlog</option>. This
+ isn't done for newer versions of MySQL any more.
+ </para>
</listitem>
<listitem>
@@ -7422,6 +7479,11 @@
<entry><literal>GLOBAL</literal></entry>
</row>
<row>
+ <entry><literal>binlog_format</literal></entry>
+ <entry>string</entry>
+ <entry><literal>GLOBAL</literal> | <literal>SESSION</literal></entry>
+ </row>
+ <row>
<entry><literal>bulk_insert_buffer_size</literal></entry>
<entry>numeric</entry>
<entry><literal>GLOBAL</literal> | <literal>SESSION</literal></entry>
Modified: trunk/refman-5.1/replication.xml
===================================================================
--- trunk/refman-5.1/replication.xml 2006-02-25 17:12:20 UTC (rev 1445)
+++ trunk/refman-5.1/replication.xml 2006-02-27 13:40:35 UTC (rev 1446)
@@ -249,7 +249,10 @@
called <firstterm>row-based replication</firstterm> (RBR). Instead
of sending SQL statements to the slave, the master writes events
to its binary log that indicate how individual table rows are
- effected.
+ effected. As of MySQL 5.1.7, a third option is available: mixed.
+ This will use statement-based replication by default, and only
+ switch to row-based replication in particular cases as described
+ below.
</para>
<para>
@@ -272,43 +275,57 @@
</para>
<para>
- MySQL Server use statement-based replication by default, even if
+ MySQL Server uses statement-based replication by default, even if
it has been configured with support for row-based replication. To
cause row-based replication to be used, start the server with the
<option>--binlog-format=row</option> option to enable row-based
- replication globally (for all client connections). The option also
- automatically turns on
- <literal>innodb_locks_unsafe_for_binlog</literal>, which is safe
- when row-based replication is used.
+ replication globally (for all client connections).
</para>
<para>
+ To use the mixed format, start the server with the
+ <option>--binlog-format=mixed</option> option.
+ </para>
+
+ <para>
Statement-based replication can be chosen at server startup either
by specifying <option>--binlog-format=statement</option> or by not
using the <option>--binlog-format</option> option at all.
</para>
-<!-- Remove comment when WL#2712 is implemented
-
<para>
- The logging format also can be selected at runtime. To specify the
+ The logging format also can be switched at runtime. To specify the
format globally for all clients, set the global value of the
- <literal>binlog_format</literal> system variable. To select
- row-based format, use either of these statements:
+ <literal>binlog_format</literal> system variable. (To change a
+ global variable you need the <literal>SUPER</literal> privilege.)
</para>
+ <para>
+ To switch to statement-based format, use either of these
+ statements:
+ </para>
+
<programlisting>
+mysql> <userinput>SET GLOBAL binlog_format = 'STATEMENT';</userinput>
+mysql> <userinput>SET GLOBAL binlog_format = 1;</userinput>
+</programlisting>
+
+ <para>
+ To switch to row-based format, use either of these statements:
+ </para>
+
+<programlisting>
mysql> <userinput>SET GLOBAL binlog_format = 'ROW';</userinput>
mysql> <userinput>SET GLOBAL binlog_format = 2;</userinput>
</programlisting>
<para>
- To select statement-based format, use either of these statements:
+ To switch to mixed format, use either of these statements:
</para>
<programlisting>
-mysql> <userinput>SET GLOBAL binlog_format = 'STATEMENT';</userinput>
-mysql> <userinput>SET GLOBAL binlog_format = 1;</userinput>
+mysql> <userinput>SET GLOBAL binlog_format = 'MIXED';</userinput>
+mysql> <userinput>SET GLOBAL binlog_format = 3;</userinput>
</programlisting>
<para>
@@ -321,9 +338,7 @@
mysql> <userinput>SET SESSION binlog_format = 'STATEMENT';</userinput>
mysql> <userinput>SET SESSION binlog_format = 'ROW';</userinput>
</programlisting>
--->
-<!-- Remove comment when WL#2712 is implemented
<para>
There are two reasons why you might want to set replication
logging on a per-connection basis:
@@ -351,9 +366,38 @@
</listitem>
</itemizedlist>
--->
<para>
+ There are exceptions when you cannot switch the replication format
+ at runtime:
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ From within a stored function or a trigger.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ If <literal>NDB</literal> is enabled.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ If the session is currently in row-based replication mode
+ and has open temporary tables.
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ Trying to switch the format in those cases results in an error.
+ </para>
+
+ <para>
Row-based replication causes <emphasis>most</emphasis> changes to
be written to the binary log using the row-based format. Some
changes, however, must be written to the binary log as statements:
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r1446 - trunk/refman-5.1 | stefan | 27 Feb |