MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:jon Date:July 24 2008 7:39am
Subject:svn commit - mysqldoc@docsrva: r11341 - in trunk: refman-4.1 refman-5.0 refman-5.1 refman-6.0
View as plain text  
Author: jstephens
Date: 2008-07-24 09:39:10 +0200 (Thu, 24 Jul 2008)
New Revision: 11341

Log:

Moving replication SHOW statements to SHOW Statement section of Syntax
chapter, left pointers in old locations

Updated dependencies

Fixes Docs Bugs:

  Bug #23023, Bug #31877




Modified:
   trunk/refman-4.1/Makefile.depends
   trunk/refman-4.1/sql-syntax-replication.xml
   trunk/refman-4.1/sql-syntax-server-administration.xml
   trunk/refman-5.0/Makefile.depends
   trunk/refman-5.0/sql-syntax-replication.xml
   trunk/refman-5.0/sql-syntax-server-administration.xml
   trunk/refman-5.1/Makefile.depends
   trunk/refman-5.1/sql-syntax-replication.xml
   trunk/refman-5.1/sql-syntax-server-administration.xml
   trunk/refman-6.0/Makefile.depends
   trunk/refman-6.0/sql-syntax-replication.xml
   trunk/refman-6.0/sql-syntax-server-administration.xml


Modified: trunk/refman-4.1/Makefile.depends
===================================================================
--- trunk/refman-4.1/Makefile.depends	2008-07-24 05:09:52 UTC (rev 11340)
+++ trunk/refman-4.1/Makefile.depends	2008-07-24 07:39:10 UTC (rev 11341)
Changed blocks: 2, Lines Added: 2, Lines Deleted: 2; 1229 bytes

@@ -2216,9 +2216,7 @@
 sql_syntax_replication_IDMAPS = \
 	../refman-4.1/metadata/dba-core.idmap \
 	../refman-4.1/metadata/functions-core.idmap \
-	../refman-4.1/metadata/programs-admin-util.idmap \
 	../refman-4.1/metadata/replication.idmap \
-	../refman-4.1/metadata/sql-syntax-data-manipulation.idmap \
 	../refman-4.1/metadata/sql-syntax-replication.idmap \
 	../refman-4.1/metadata/sql-syntax-server-administration.idmap
 sql-syntax-replication.validpure: $(sql_syntax_replication_SOURCES)

@@ -2249,7 +2247,9 @@
 	../refman-4.1/metadata/internationalization.idmap \
 	../refman-4.1/metadata/language-structure.idmap \
 	../refman-4.1/metadata/optimization.idmap \
+	../refman-4.1/metadata/programs-admin-util.idmap \
 	../refman-4.1/metadata/programs-installation.idmap \
+	../refman-4.1/metadata/replication.idmap \
 	../refman-4.1/metadata/se-innodb-core.idmap \
 	../refman-4.1/metadata/sql-syntax-data-definition.idmap \
 	../refman-4.1/metadata/sql-syntax-data-manipulation.idmap \


Modified: trunk/refman-4.1/sql-syntax-replication.xml
===================================================================
--- trunk/refman-4.1/sql-syntax-replication.xml	2008-07-24 05:09:52 UTC (rev 11340)
+++ trunk/refman-4.1/sql-syntax-replication.xml	2008-07-24 07:39:10 UTC (rev 11341)
Changed blocks: 4, Lines Added: 42, Lines Deleted: 802; 26597 bytes

@@ -39,6 +39,42 @@
       statements for managing slave servers.
     </para>
 
+    <para>
+      The following <literal>SHOW</literal> statements are used with
+      master servers in replication:
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
+            <literal>SHOW BINARY LOGS</literal>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>SHOW BINLOG EVENTS</literal>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>SHOW MASTER STATUS</literal>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>SHOW SLAVE HOSTS</literal>
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+      For information about these statements, see
+      <xref linkend="show"/>.
+    </para>
+
     <section id="purge-master-logs">
 
       <title><literal>PURGE MASTER LOGS</literal> Syntax</title>

@@ -231,262 +267,6 @@
 
     </section>
 
-    <section id="show-binlog-events">
-
-      <title><literal>SHOW BINLOG EVENTS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW BINLOG EVENTS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW BINLOG EVENTS"/>
-
-      <remark role="help-keywords">
-        SHOW BINLOG EVENTS LIMIT FROM IN
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW BINLOG EVENTS
-   [IN '<replaceable>log_name</replaceable>'] [FROM <replaceable>pos</replaceable>] [LIMIT [<replaceable>offset</replaceable>,] <replaceable>row_count</replaceable>]
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Shows the events in the binary log. If you do not specify
-        <literal>'<replaceable>log_name</replaceable>'</literal>, the
-        first binary log is displayed.
-      </para>
-
-      <remark role="help-description-end"/>
-
-      <para>
-        The <literal>LIMIT</literal> clause has the same syntax as for
-        the <literal>SELECT</literal> statement. See
-        <xref linkend="select"/>.
-      </para>
-
-      <para>
-        This statement is available as of MySQL 4.0.
-      </para>
-
-      <note>
-        <para>
-          Issuing a <literal>SHOW BINLOG EVENTS</literal> with no
-          <literal>LIMIT</literal> clause could start a very time- and
-          resource-consuming process because the server returns to the
-          client the complete contents of the binary log (which includes
-          all statements executed by the server that modify data). As an
-          alternative to <literal>SHOW BINLOG EVENTS</literal>, use the
-          <command>mysqlbinlog</command> utility to save the binary log
-          to a text file for later examination and analysis. See
-          <xref linkend="mysqlbinlog"/>.
-        </para>
-      </note>
-
-      <note>
-        <para>
-          Events relating to the setting of variables are not included
-          in the output from <literal>SHOW BINLOG EVENTS</literal>. To
-          get complete coverage of events within a binary log, use
-          <link linkend="mysqlbinlog"><literal>mysqlbinlog</literal></link>.
-        </para>
-      </note>
-
-    </section>
-
-    <section id="show-binary-logs">
-
-      <title><literal>SHOW BINARY LOGS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW BINARY LOGS</primary>
-      </indexterm>
-
-      <indexterm>
-        <primary>SHOW MASTER LOGS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW BINARY LOGS"/>
-
-      <remark role="help-keywords">
-        SHOW BINARY MASTER LOGS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW BINARY LOGS
-SHOW MASTER LOGS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Lists the binary log files on the server. This statement is used
-        as part of the procedure described in
-        <xref linkend="purge-master-logs"/>, that shows how to determine
-        which logs can be purged.
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW BINARY LOGS;</userinput>
-+---------------+-----------+
-| Log_name      | File_size |
-+---------------+-----------+
-| binlog.000015 |    724935 |
-| binlog.000016 |    733481 |
-+---------------+-----------+
-</programlisting>
-
-      <remark role="help-description-end"/>
-
-      <para>
-        <literal>SHOW MASTER LOGS</literal> was added in MySQL 3.23.38.
-        As of MySQL 4.1.1, you can also use <literal>SHOW BINARY
-        LOGS</literal>, which is equivalent. The
-        <literal>File_size</literal> column is displayed as of MySQL
-        5.0.7.
-      </para>
-
-    </section>
-
-    <section id="show-master-status">
-
-      <title><literal>SHOW MASTER STATUS</literal> Syntax</title>
-
-      <remark role="todo">
-        describe output
-      </remark>
-
-      <indexterm>
-        <primary>SHOW MASTER STATUS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW MASTER STATUS"/>
-
-      <remark role="help-keywords">
-        SHOW MASTER STATUS
-      </remark>
-
-<programlisting>
-SHOW MASTER STATUS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Provides status information about the binary log files of the
-        master. Example:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW MASTER STATUS;</userinput>
-+---------------+----------+--------------+------------------+
-| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB |
-+---------------+----------+--------------+------------------+
-| mysql-bin.003 | 73       | test         | manual,mysql     |
-+---------------+----------+--------------+------------------+
-</programlisting>
-
-      <remark role="help-description-end"/>
-
-    </section>
-
-    <section id="show-slave-hosts">
-
-      <title><literal>SHOW SLAVE HOSTS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW SLAVE HOSTS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW SLAVE HOSTS"/>
-
-      <remark role="help-keywords">
-        SHOW SLAVE HOSTS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW SLAVE HOSTS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Displays a list of replication slaves currently registered with
-        the master. Only slaves started with the
-        <option>--report-host=<replaceable>slave_name</replaceable></option>
-        option are visible in this list.
-      </para>
-
-      <para>
-        The list is displayed on any server (not just the master
-        server). The output looks like this:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW SLAVE HOSTS</userinput>;
-+------------+-----------+------+-----------+
-| Server_id  | Host      | Port | Master_id |
-+------------+-----------+------+-----------+
-|  192168010 | iconnect2 | 3306 | 192168011 |
-| 1921680101 | athena    | 3306 | 192168011 |
-+------------+-----------+------+-----------+
-</programlisting>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal>Server_id</literal>: The unique server ID of the
-            slave server, as configured in the server's option file, or
-            on the command line with
-            <option>--server-id=<replaceable>value</replaceable></option>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Host</literal>: The host name of the slave server,
-            as configured in the server's option file, or on the command
-            line with
-            <option>--report-host=<replaceable>value</replaceable></option>.
-            Note that this can differ from the machine name as
-            configured in the operating system.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Port</literal>: The port the slave server is
-            listening on.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_id</literal>: The unique server ID of the
-            master server that the slave server is replicating from.
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-      <para>
-        Some MySQL versions report another variable,
-        <literal>Rpl_recovery_rank</literal>. This variable was never
-        used, and was eventually removed.
-      </para>
-
-      <remark role="help-description-end"/>
-
-    </section>
-
   </section>
 
   <section id="replication-slave-sql">

@@ -515,6 +295,12 @@
       statements for managing master servers.
     </para>
 
+    <para>
+      <literal>SHOW SLAVE STATUS</literal> is also used with replication
+      slaves. For information about this statement, see
+      <xref linkend="show-slave-status"/>.
+    </para>
+
     <section id="change-master-to">
 
       <title><literal>CHANGE MASTER TO</literal> Syntax</title>

@@ -1107,552 +893,6 @@
 
     </section>
 
-    <section id="show-slave-status">
-
-      <title><literal>SHOW SLAVE STATUS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW SLAVE STATUS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW SLAVE STATUS"/>
-
-      <remark role="help-keywords">
-        SHOW SLAVE STATUS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW SLAVE STATUS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        This statement provides status information on essential
-        parameters of the slave threads. If you issue this statement
-        using the <command>mysql</command> client, you can use a
-        <literal>\G</literal> statement terminator rather than a
-        semicolon to obtain a more readable vertical layout:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW SLAVE STATUS\G</userinput>
-*************************** 1. row ***************************
-       Slave_IO_State: Waiting for master to send event
-          Master_Host: localhost
-          Master_User: root
-          Master_Port: 3306
-        Connect_Retry: 3
-      Master_Log_File: gbichot-bin.005
-  Read_Master_Log_Pos: 79
-       Relay_Log_File: gbichot-relay-bin.005
-        Relay_Log_Pos: 548
-Relay_Master_Log_File: gbichot-bin.005
-     Slave_IO_Running: Yes
-    Slave_SQL_Running: Yes
-      Replicate_Do_DB:
-  Replicate_Ignore_DB:
-           Last_Errno: 0
-           Last_Error:
-         Skip_Counter: 0
-  Exec_Master_Log_Pos: 79
-      Relay_Log_Space: 552
-      Until_Condition: None
-       Until_Log_File:
-        Until_Log_Pos: 0
-   Master_SSL_Allowed: No
-   Master_SSL_CA_File:
-   Master_SSL_CA_Path:
-      Master_SSL_Cert:
-    Master_SSL_Cipher:
-       Master_SSL_Key:
-Seconds_Behind_Master: 8
-</programlisting>
-
-      <remark role="help-description-end"/>
-
-      <para>
-        Depending on your version of MySQL, you may not see all the
-        fields just shown. In particular, several fields are present
-        only as of MySQL 4.1.1.
-      </para>
-
-      <para>
-        <literal>SHOW SLAVE STATUS</literal> returns the following
-        fields:
-      </para>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal>Slave_IO_State</literal>
-          </para>
-
-          <remark role="todo">
-            [js] What actually changed in 4.1.14?
-          </remark>
-
-          <para>
-            A copy of the <literal>State</literal> field of the output
-            of <literal>SHOW PROCESSLIST</literal> for the slave I/O
-            thread. This tells you what the thread is doing: trying to
-            connect to the master, waiting for events from the master,
-            reconnecting to the master, and so on. Possible states are
-            listed in
-            <xref linkend="replication-implementation-details"/>. It is
-            necessary to check this field for older versions of MySQL
-            (prior to 4.1.14) because in these versions the thread could
-            be running while unsuccessfully trying to connect to the
-            master; only this field makes you aware of the connection
-            problem. The state of the SQL thread is not copied because
-            it is simpler. If it is running, there is no problem; if it
-            is not, you can find the error in the
-            <literal>Last_Error</literal> field (described below).
-          </para>
-
-          <para>
-            This field is present beginning with MySQL 4.1.1.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_Host</literal>
-          </para>
-
-          <para>
-            The current master host.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_User</literal>
-          </para>
-
-          <para>
-            The current user used to connect to the master.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_Port</literal>
-          </para>
-
-          <para>
-            The current master port.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Connect_Retry</literal>
-          </para>
-
-          <para>
-            The number of seconds between connect retries (default 60).
-            This may be set with the <literal>CHANGE MASTER TO</literal>
-            statement or <option>--master-connect-retry</option> option.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_Log_File</literal>
-          </para>
-
-          <para>
-            The name of the master binary log file from which the I/O
-            thread is currently reading.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Read_Master_Log_Pos</literal>
-          </para>
-
-          <para>
-            The position up to which the I/O thread has read in the
-            current master binary log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Log_File</literal>
-          </para>
-
-          <para>
-            The name of the relay log file from which the SQL thread is
-            currently reading and executing.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Log_Pos</literal>
-          </para>
-
-          <para>
-            The position up to which the SQL thread has read and
-            executed in the current relay log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Master_Log_File</literal>
-          </para>
-
-          <para>
-            The name of the master binary log file containing the most
-            recent event executed by the SQL thread.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Slave_IO_Running</literal>
-          </para>
-
-          <para>
-            Whether the I/O thread is started and has connected
-            successfully to the master. For older versions of MySQL
-            (prior to 4.1.14 and 5.0.12)
-            <literal>Slave_IO_Running</literal> is
-            <literal>YES</literal> if the I/O thread is started, even if
-            the slave hasn't connected to the master yet.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Slave_SQL_Running</literal>
-          </para>
-
-          <para>
-            Whether the SQL thread is started.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Replicate_Do_DB</literal>,
-            <literal>Replicate_Ignore_DB</literal>
-          </para>
-
-          <para>
-            The lists of databases that were specified with the
-            <option>--replicate-do-db</option> and
-            <option>--replicate-ignore-db</option> options, if any.
-          </para>
-
-          <para>
-            These fields are present beginning with MySQL 4.1.1.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Replicate_Do_Table</literal>,
-            <literal>Replicate_Ignore_Table</literal>,
-            <literal>Replicate_Wild_Do_Table</literal>,
-            <literal>Replicate_Wild_Ignore_Table</literal>
-          </para>
-
-          <para>
-            The lists of tables that were specified with the
-            <option>--replicate-do-table</option>,
-            <option>--replicate-ignore-table</option>,
-            <option>--replicate-wild-do-table</option>, and
-            <option>--replicate-wild-ignore_table</option> options, if
-            any.
-          </para>
-
-          <para>
-            These fields are present beginning with MySQL 4.1.1.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Last_Errno</literal>, <literal>Last_Error</literal>
-          </para>
-
-          <para>
-            The error number and error message returned by the most
-            recently executed statement. An error number of 0 and
-            message of the empty string mean <quote>no error.</quote> If
-            the <literal>Last_Error</literal> value is not empty, it
-            also appears as a message in the slave's error log. For
-            example:
-          </para>
-
-<programlisting>
-Last_Errno: 1051
-Last_Error: error 'Unknown table 'z'' on query 'drop table z'
-</programlisting>
-
-          <para>
-            The message indicates that the table <literal>z</literal>
-            existed on the master and was dropped there, but it did not
-            exist on the slave, so <literal>DROP TABLE</literal> failed
-            on the slave. (This might occur, for example, if you forget
-            to copy the table to the slave when setting up replication.)
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Skip_Counter</literal>
-          </para>
-
-          <para>
-            The most recently used value for
-            <literal>SQL_SLAVE_SKIP_COUNTER</literal>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Exec_Master_Log_Pos</literal>
-          </para>
-
-          <para>
-            The position of the last event executed by the SQL thread
-            from the master's binary log
-            (<literal>Relay_Master_Log_File</literal>).
-            (<literal>Relay_Master_Log_File</literal>,
-            <literal>Exec_Master_Log_Pos</literal>) in the master's
-            binary log corresponds to
-            (<literal>Relay_Log_File</literal>,
-            <literal>Relay_Log_Pos</literal>) in the relay log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Log_Space</literal>
-          </para>
-
-          <para>
-            The total combined size of all existing relay logs.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Until_Condition</literal>,
-            <literal>Until_Log_File</literal>,
-            <literal>Until_Log_Pos</literal>
-          </para>
-
-          <para>
-            The values specified in the <literal>UNTIL</literal> clause
-            of the <literal>START SLAVE</literal> statement.
-          </para>
-
-          <para>
-            <literal>Until_Condition</literal> has these values:
-          </para>
-
-          <itemizedlist>
-
-            <listitem>
-              <para>
-                <literal>None</literal> if no <literal>UNTIL</literal>
-                clause was specified
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>Master</literal> if the slave is reading until
-                a given position in the master's binary logs
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>Relay</literal> if the slave is reading until a
-                given position in its relay logs
-              </para>
-            </listitem>
-
-          </itemizedlist>
-
-          <para>
-            <literal>Until_Log_File</literal> and
-            <literal>Until_Log_Pos</literal> indicate the log filename
-            and position values that define the point at which the SQL
-            thread stops executing.
-          </para>
-
-          <para>
-            These fields are present beginning with MySQL 4.1.1.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_SSL_Allowed</literal>,
-            <literal>Master_SSL_CA_File</literal>,
-            <literal>Master_SSL_CA_Path</literal>,
-            <literal>Master_SSL_Cert</literal>,
-            <literal>Master_SSL_Cipher</literal>,
-            <literal>Master_SSL_Key</literal>
-          </para>
-
-          <para>
-            These fields show the SSL parameters used by the slave to
-            connect to the master, if any.
-          </para>
-
-          <para>
-            <literal>Master_SSL_Allowed</literal> has these values:
-          </para>
-
-          <itemizedlist>
-
-            <listitem>
-              <para>
-                <literal>Yes</literal> if an SSL connection to the
-                master is permitted
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>No</literal> if an SSL connection to the master
-                is not permitted
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>Ignored</literal> if an SSL connection is
-                permitted but the slave server does not have SSL support
-                enabled
-              </para>
-            </listitem>
-
-          </itemizedlist>
-
-          <para>
-            The values of the other SSL-related fields correspond to the
-            values of the <literal>MASTER_SSL_CA</literal>,
-            <literal>MASTER_SSL_CAPATH</literal>,
-            <literal>MASTER_SSL_CERT</literal>,
-            <literal>MASTER_SSL_CIPHER</literal>, and
-            <literal>MASTER_SSL_KEY</literal> options to the
-            <literal>CHANGE MASTER</literal> statement. See
-            <xref linkend="change-master-to"/>.
-          </para>
-
-          <para>
-            These fields are present beginning with MySQL 4.1.1.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Seconds_Behind_Master</literal>
-          </para>
-
-          <para>
-            This field is present beginning with MySQL 4.1.1. It is been
-            experimental and has been changed in MySQL 4.1.9. The
-            following applies to slaves running MySQL 4.1.9 or newer.
-            This field is an indication of how <quote>late</quote> the
-            slave is:
-          </para>
-
-          <itemizedlist>
-
-            <listitem>
-              <para>
-                When the slave SQL thread is actively running
-                (processing updates), this field is the number of
-                seconds that have elapsed since the timestamp of the
-                most recent event on the master executed by that thread.
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                When the SQL thread has caught up to the slave I/O
-                thread and goes idle waiting for more events from the
-                I/O thread, this field is zero.
-              </para>
-            </listitem>
-
-          </itemizedlist>
-
-          <para>
-            In essence, this field measures the time difference in
-            seconds between the slave SQL thread and the slave I/O
-            thread.
-          </para>
-
-          <remark role="todo">
-            How fast is &quot;fast&quot;?
-          </remark>
-
-          <para>
-            If the network connection between master and slave is fast,
-            the slave I/O thread is very close to the master, so this
-            field is a good approximation of how late the slave SQL
-            thread is compared to the master. If the network is slow,
-            this is <emphasis>not</emphasis> a good approximation; the
-            slave SQL thread may quite often be caught up with the
-            slow-reading slave I/O thread, so
-            <literal>Seconds_Behind_Master</literal> often shows a value
-            of 0, even if the I/O thread is late compared to the master.
-            In other words, <emphasis>this column is useful only for
-            fast networks</emphasis>.
-          </para>
-
-          <para>
-            This time difference computation works even though the
-            master and slave do not have identical clocks (the clock
-            difference is computed when the slave I/O thread starts, and
-            assumed to remain constant from then on).
-            <literal>Seconds_Behind_Master</literal> is
-            <literal>NULL</literal> (which means <quote>unknown</quote>)
-            if the slave SQL thread is not running, or if the slave I/O
-            thread is not running or not connected to master. For
-            example if the slave I/O thread is sleeping for the number
-            of seconds given by the <literal>CHANGE MASTER TO</literal>
-            statement or <option>--master-connect-retry</option> option
-            (default 60) before reconnecting, <literal>NULL</literal> is
-            shown, as the slave cannot know what the master is doing,
-            and so cannot say reliably how late it is.
-          </para>
-
-          <para>
-            This field has one limitation. The timestamp is preserved
-            through replication, which means that, if a master M1 is
-            itself a slave of M0, any event from M1's binlog which
-            originates in replicating an event from M0's binlog has the
-            timestamp of that event. This enables MySQL to replicate
-            <literal>TIMESTAMP</literal> successfully. However, the
-            drawback for <literal>Seconds_Behind_Master</literal> is
-            that if M1 also receives direct updates from clients, the
-            value randomly deviates, because sometimes the last M1's
-            event is from M0 and sometimes it is the most recent
-            timestamp from a direct update.
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-    </section>
-
     <section id="start-slave">
 
       <title><literal>START SLAVE</literal> Syntax</title>


Modified: trunk/refman-4.1/sql-syntax-server-administration.xml
===================================================================
--- trunk/refman-4.1/sql-syntax-server-administration.xml	2008-07-24 05:09:52 UTC (rev 11340)
+++ trunk/refman-4.1/sql-syntax-server-administration.xml	2008-07-24 07:39:10 UTC (rev 11341)
Changed blocks: 4, Lines Added: 802, Lines Deleted: 14; 26121 bytes

@@ -3131,20 +3131,6 @@
     </indexterm>
 
     <para>
-      The <literal>SHOW</literal> statement also has forms that provide
-      information about replication master and slave servers and are
-      described in <xref linkend="sql-syntax-replication"/>:
-    </para>
-
-<programlisting>
-SHOW BINARY LOGS
-SHOW BINLOG EVENTS
-SHOW MASTER STATUS
-SHOW SLAVE HOSTS
-SHOW SLAVE STATUS
-</programlisting>
-
-    <para>
       If the syntax for a given <literal>SHOW</literal> statement
       includes a <function role="sqlop" condition="like">LIKE
       '<replaceable>pattern</replaceable>'</function> part,

@@ -3166,6 +3152,128 @@
       information.
     </para>
 
+    <section id="show-binary-logs">
+
+      <title><literal>SHOW BINARY LOGS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW BINARY LOGS</primary>
+      </indexterm>
+
+      <indexterm>
+        <primary>SHOW MASTER LOGS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW BINARY LOGS"/>
+
+      <remark role="help-keywords">
+        SHOW BINARY MASTER LOGS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW BINARY LOGS
+SHOW MASTER LOGS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Lists the binary log files on the server. This statement is used
+        as part of the procedure described in
+        <xref linkend="purge-master-logs"/>, that shows how to determine
+        which logs can be purged.
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW BINARY LOGS;</userinput>
++---------------+-----------+
+| Log_name      | File_size |
++---------------+-----------+
+| binlog.000015 |    724935 |
+| binlog.000016 |    733481 |
++---------------+-----------+
+</programlisting>
+
+      <remark role="help-description-end"/>
+
+      <para>
+        <literal>SHOW MASTER LOGS</literal> was added in MySQL 3.23.38.
+        As of MySQL 4.1.1, you can also use <literal>SHOW BINARY
+        LOGS</literal>, which is equivalent. The
+        <literal>File_size</literal> column is displayed as of MySQL
+        5.0.7.
+      </para>
+
+    </section>
+
+    <section id="show-binlog-events">
+
+      <title><literal>SHOW BINLOG EVENTS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW BINLOG EVENTS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW BINLOG EVENTS"/>
+
+      <remark role="help-keywords">
+        SHOW BINLOG EVENTS LIMIT FROM IN
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW BINLOG EVENTS
+   [IN '<replaceable>log_name</replaceable>'] [FROM <replaceable>pos</replaceable>] [LIMIT [<replaceable>offset</replaceable>,] <replaceable>row_count</replaceable>]
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Shows the events in the binary log. If you do not specify
+        <literal>'<replaceable>log_name</replaceable>'</literal>, the
+        first binary log is displayed.
+      </para>
+
+      <remark role="help-description-end"/>
+
+      <para>
+        The <literal>LIMIT</literal> clause has the same syntax as for
+        the <literal>SELECT</literal> statement. See
+        <xref linkend="select"/>.
+      </para>
+
+      <para>
+        This statement is available as of MySQL 4.0.
+      </para>
+
+      <note>
+        <para>
+          Issuing a <literal>SHOW BINLOG EVENTS</literal> with no
+          <literal>LIMIT</literal> clause could start a very time- and
+          resource-consuming process because the server returns to the
+          client the complete contents of the binary log (which includes
+          all statements executed by the server that modify data). As an
+          alternative to <literal>SHOW BINLOG EVENTS</literal>, use the
+          <command>mysqlbinlog</command> utility to save the binary log
+          to a text file for later examination and analysis. See
+          <xref linkend="mysqlbinlog"/>.
+        </para>
+      </note>
+
+      <note>
+        <para>
+          Events relating to the setting of variables are not included
+          in the output from <literal>SHOW BINLOG EVENTS</literal>. To
+          get complete coverage of events within a binary log, use
+          <link linkend="mysqlbinlog"><literal>mysqlbinlog</literal></link>.
+        </para>
+      </note>
+
+    </section>
+
     <section id="show-character-set">
 
       <title><literal>SHOW CHARACTER SET</literal> Syntax</title>

@@ -4493,6 +4601,48 @@
 
     </section>
 
+    <section id="show-master-status">
+
+      <title><literal>SHOW MASTER STATUS</literal> Syntax</title>
+
+      <remark role="todo">
+        describe output
+      </remark>
+
+      <indexterm>
+        <primary>SHOW MASTER STATUS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW MASTER STATUS"/>
+
+      <remark role="help-keywords">
+        SHOW MASTER STATUS
+      </remark>
+
+<programlisting>
+SHOW MASTER STATUS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Provides status information about the binary log files of the
+        master. Example:
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW MASTER STATUS;</userinput>
++---------------+----------+--------------+------------------+
+| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB |
++---------------+----------+--------------+------------------+
+| mysql-bin.003 | 73       | test         | manual,mysql     |
++---------------+----------+--------------+------------------+
+</programlisting>
+
+      <remark role="help-description-end"/>
+
+    </section>
+
     <section id="show-open-tables">
 
       <title><literal>SHOW OPEN TABLES</literal> Syntax</title>

@@ -4946,6 +5096,644 @@
 
     </section>
 
+    <section id="show-slave-hosts">
+
+      <title><literal>SHOW SLAVE HOSTS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW SLAVE HOSTS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW SLAVE HOSTS"/>
+
+      <remark role="help-keywords">
+        SHOW SLAVE HOSTS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW SLAVE HOSTS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Displays a list of replication slaves currently registered with
+        the master. Only slaves started with the
+        <option>--report-host=<replaceable>slave_name</replaceable></option>
+        option are visible in this list.
+      </para>
+
+      <para>
+        The list is displayed on any server (not just the master
+        server). The output looks like this:
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW SLAVE HOSTS</userinput>;
++------------+-----------+------+-----------+
+| Server_id  | Host      | Port | Master_id |
++------------+-----------+------+-----------+
+|  192168010 | iconnect2 | 3306 | 192168011 |
+| 1921680101 | athena    | 3306 | 192168011 |
++------------+-----------+------+-----------+
+</programlisting>
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
+            <literal>Server_id</literal>: The unique server ID of the
+            slave server, as configured in the server's option file, or
+            on the command line with
+            <option>--server-id=<replaceable>value</replaceable></option>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Host</literal>: The host name of the slave server,
+            as configured in the server's option file, or on the command
+            line with
+            <option>--report-host=<replaceable>value</replaceable></option>.
+            Note that this can differ from the machine name as
+            configured in the operating system.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Port</literal>: The port the slave server is
+            listening on.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_id</literal>: The unique server ID of the
+            master server that the slave server is replicating from.
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+      <para>
+        Some MySQL versions report another variable,
+        <literal>Rpl_recovery_rank</literal>. This variable was never
+        used, and was eventually removed.
+      </para>
+
+      <remark role="help-description-end"/>
+
+    </section>
+
+    <section id="show-slave-status">
+
+      <title><literal>SHOW SLAVE STATUS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW SLAVE STATUS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW SLAVE STATUS"/>
+
+      <remark role="help-keywords">
+        SHOW SLAVE STATUS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW SLAVE STATUS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        This statement provides status information on essential
+        parameters of the slave threads. If you issue this statement
+        using the <command>mysql</command> client, you can use a
+        <literal>\G</literal> statement terminator rather than a
+        semicolon to obtain a more readable vertical layout:
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW SLAVE STATUS\G</userinput>
+*************************** 1. row ***************************
+       Slave_IO_State: Waiting for master to send event
+          Master_Host: localhost
+          Master_User: root
+          Master_Port: 3306
+        Connect_Retry: 3
+      Master_Log_File: gbichot-bin.005
+  Read_Master_Log_Pos: 79
+       Relay_Log_File: gbichot-relay-bin.005
+        Relay_Log_Pos: 548
+Relay_Master_Log_File: gbichot-bin.005
+     Slave_IO_Running: Yes
+    Slave_SQL_Running: Yes
+      Replicate_Do_DB:
+  Replicate_Ignore_DB:
+           Last_Errno: 0
+           Last_Error:
+         Skip_Counter: 0
+  Exec_Master_Log_Pos: 79
+      Relay_Log_Space: 552
+      Until_Condition: None
+       Until_Log_File:
+        Until_Log_Pos: 0
+   Master_SSL_Allowed: No
+   Master_SSL_CA_File:
+   Master_SSL_CA_Path:
+      Master_SSL_Cert:
+    Master_SSL_Cipher:
+       Master_SSL_Key:
+Seconds_Behind_Master: 8
+</programlisting>
+
+      <remark role="help-description-end"/>
+
+      <para>
+        Depending on your version of MySQL, you may not see all the
+        fields just shown. In particular, several fields are present
+        only as of MySQL 4.1.1.
+      </para>
+
+      <para>
+        <literal>SHOW SLAVE STATUS</literal> returns the following
+        fields:
+      </para>
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
+            <literal>Slave_IO_State</literal>
+          </para>
+
+          <remark role="todo">
+            [js] What actually changed in 4.1.14?
+          </remark>
+
+          <para>
+            A copy of the <literal>State</literal> field of the output
+            of <literal>SHOW PROCESSLIST</literal> for the slave I/O
+            thread. This tells you what the thread is doing: trying to
+            connect to the master, waiting for events from the master,
+            reconnecting to the master, and so on. Possible states are
+            listed in
+            <xref linkend="replication-implementation-details"/>. It is
+            necessary to check this field for older versions of MySQL
+            (prior to 4.1.14) because in these versions the thread could
+            be running while unsuccessfully trying to connect to the
+            master; only this field makes you aware of the connection
+            problem. The state of the SQL thread is not copied because
+            it is simpler. If it is running, there is no problem; if it
+            is not, you can find the error in the
+            <literal>Last_Error</literal> field (described below).
+          </para>
+
+          <para>
+            This field is present beginning with MySQL 4.1.1.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_Host</literal>
+          </para>
+
+          <para>
+            The current master host.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_User</literal>
+          </para>
+
+          <para>
+            The current user used to connect to the master.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_Port</literal>
+          </para>
+
+          <para>
+            The current master port.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Connect_Retry</literal>
+          </para>
+
+          <para>
+            The number of seconds between connect retries (default 60).
+            This may be set with the <literal>CHANGE MASTER TO</literal>
+            statement or <option>--master-connect-retry</option> option.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_Log_File</literal>
+          </para>
+
+          <para>
+            The name of the master binary log file from which the I/O
+            thread is currently reading.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Read_Master_Log_Pos</literal>
+          </para>
+
+          <para>
+            The position up to which the I/O thread has read in the
+            current master binary log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Log_File</literal>
+          </para>
+
+          <para>
+            The name of the relay log file from which the SQL thread is
+            currently reading and executing.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Log_Pos</literal>
+          </para>
+
+          <para>
+            The position up to which the SQL thread has read and
+            executed in the current relay log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Master_Log_File</literal>
+          </para>
+
+          <para>
+            The name of the master binary log file containing the most
+            recent event executed by the SQL thread.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Slave_IO_Running</literal>
+          </para>
+
+          <para>
+            Whether the I/O thread is started and has connected
+            successfully to the master. For older versions of MySQL
+            (prior to 4.1.14 and 5.0.12)
+            <literal>Slave_IO_Running</literal> is
+            <literal>YES</literal> if the I/O thread is started, even if
+            the slave hasn't connected to the master yet.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Slave_SQL_Running</literal>
+          </para>
+
+          <para>
+            Whether the SQL thread is started.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Replicate_Do_DB</literal>,
+            <literal>Replicate_Ignore_DB</literal>
+          </para>
+
+          <para>
+            The lists of databases that were specified with the
+            <option>--replicate-do-db</option> and
+            <option>--replicate-ignore-db</option> options, if any.
+          </para>
+
+          <para>
+            These fields are present beginning with MySQL 4.1.1.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Replicate_Do_Table</literal>,
+            <literal>Replicate_Ignore_Table</literal>,
+            <literal>Replicate_Wild_Do_Table</literal>,
+            <literal>Replicate_Wild_Ignore_Table</literal>
+          </para>
+
+          <para>
+            The lists of tables that were specified with the
+            <option>--replicate-do-table</option>,
+            <option>--replicate-ignore-table</option>,
+            <option>--replicate-wild-do-table</option>, and
+            <option>--replicate-wild-ignore_table</option> options, if
+            any.
+          </para>
+
+          <para>
+            These fields are present beginning with MySQL 4.1.1.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Last_Errno</literal>, <literal>Last_Error</literal>
+          </para>
+
+          <para>
+            The error number and error message returned by the most
+            recently executed statement. An error number of 0 and
+            message of the empty string mean <quote>no error.</quote> If
+            the <literal>Last_Error</literal> value is not empty, it
+            also appears as a message in the slave's error log. For
+            example:
+          </para>
+
+<programlisting>
+Last_Errno: 1051
+Last_Error: error 'Unknown table 'z'' on query 'drop table z'
+</programlisting>
+
+          <para>
+            The message indicates that the table <literal>z</literal>
+            existed on the master and was dropped there, but it did not
+            exist on the slave, so <literal>DROP TABLE</literal> failed
+            on the slave. (This might occur, for example, if you forget
+            to copy the table to the slave when setting up replication.)
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Skip_Counter</literal>
+          </para>
+
+          <para>
+            The most recently used value for
+            <literal>SQL_SLAVE_SKIP_COUNTER</literal>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Exec_Master_Log_Pos</literal>
+          </para>
+
+          <para>
+            The position of the last event executed by the SQL thread
+            from the master's binary log
+            (<literal>Relay_Master_Log_File</literal>).
+            (<literal>Relay_Master_Log_File</literal>,
+            <literal>Exec_Master_Log_Pos</literal>) in the master's
+            binary log corresponds to
+            (<literal>Relay_Log_File</literal>,
+            <literal>Relay_Log_Pos</literal>) in the relay log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Log_Space</literal>
+          </para>
+
+          <para>
+            The total combined size of all existing relay logs.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Until_Condition</literal>,
+            <literal>Until_Log_File</literal>,
+            <literal>Until_Log_Pos</literal>
+          </para>
+
+          <para>
+            The values specified in the <literal>UNTIL</literal> clause
+            of the <literal>START SLAVE</literal> statement.
+          </para>
+
+          <para>
+            <literal>Until_Condition</literal> has these values:
+          </para>
+
+          <itemizedlist>
+
+            <listitem>
+              <para>
+                <literal>None</literal> if no <literal>UNTIL</literal>
+                clause was specified
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>Master</literal> if the slave is reading until
+                a given position in the master's binary logs
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>Relay</literal> if the slave is reading until a
+                given position in its relay logs
+              </para>
+            </listitem>
+
+          </itemizedlist>
+
+          <para>
+            <literal>Until_Log_File</literal> and
+            <literal>Until_Log_Pos</literal> indicate the log filename
+            and position values that define the point at which the SQL
+            thread stops executing.
+          </para>
+
+          <para>
+            These fields are present beginning with MySQL 4.1.1.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_SSL_Allowed</literal>,
+            <literal>Master_SSL_CA_File</literal>,
+            <literal>Master_SSL_CA_Path</literal>,
+            <literal>Master_SSL_Cert</literal>,
+            <literal>Master_SSL_Cipher</literal>,
+            <literal>Master_SSL_Key</literal>
+          </para>
+
+          <para>
+            These fields show the SSL parameters used by the slave to
+            connect to the master, if any.
+          </para>
+
+          <para>
+            <literal>Master_SSL_Allowed</literal> has these values:
+          </para>
+
+          <itemizedlist>
+
+            <listitem>
+              <para>
+                <literal>Yes</literal> if an SSL connection to the
+                master is permitted
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>No</literal> if an SSL connection to the master
+                is not permitted
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>Ignored</literal> if an SSL connection is
+                permitted but the slave server does not have SSL support
+                enabled
+              </para>
+            </listitem>
+
+          </itemizedlist>
+
+          <para>
+            The values of the other SSL-related fields correspond to the
+            values of the <literal>MASTER_SSL_CA</literal>,
+            <literal>MASTER_SSL_CAPATH</literal>,
+            <literal>MASTER_SSL_CERT</literal>,
+            <literal>MASTER_SSL_CIPHER</literal>, and
+            <literal>MASTER_SSL_KEY</literal> options to the
+            <literal>CHANGE MASTER</literal> statement. See
+            <xref linkend="change-master-to"/>.
+          </para>
+
+          <para>
+            These fields are present beginning with MySQL 4.1.1.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Seconds_Behind_Master</literal>
+          </para>
+
+          <para>
+            This field is present beginning with MySQL 4.1.1. It is been
+            experimental and has been changed in MySQL 4.1.9. The
+            following applies to slaves running MySQL 4.1.9 or newer.
+            This field is an indication of how <quote>late</quote> the
+            slave is:
+          </para>
+
+          <itemizedlist>
+
+            <listitem>
+              <para>
+                When the slave SQL thread is actively running
+                (processing updates), this field is the number of
+                seconds that have elapsed since the timestamp of the
+                most recent event on the master executed by that thread.
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                When the SQL thread has caught up to the slave I/O
+                thread and goes idle waiting for more events from the
+                I/O thread, this field is zero.
+              </para>
+            </listitem>
+
+          </itemizedlist>
+
+          <para>
+            In essence, this field measures the time difference in
+            seconds between the slave SQL thread and the slave I/O
+            thread.
+          </para>
+
+          <remark role="todo">
+            How fast is &quot;fast&quot;?
+          </remark>
+
+          <para>
+            If the network connection between master and slave is fast,
+            the slave I/O thread is very close to the master, so this
+            field is a good approximation of how late the slave SQL
+            thread is compared to the master. If the network is slow,
+            this is <emphasis>not</emphasis> a good approximation; the
+            slave SQL thread may quite often be caught up with the
+            slow-reading slave I/O thread, so
+            <literal>Seconds_Behind_Master</literal> often shows a value
+            of 0, even if the I/O thread is late compared to the master.
+            In other words, <emphasis>this column is useful only for
+            fast networks</emphasis>.
+          </para>
+
+          <para>
+            This time difference computation works even though the
+            master and slave do not have identical clocks (the clock
+            difference is computed when the slave I/O thread starts, and
+            assumed to remain constant from then on).
+            <literal>Seconds_Behind_Master</literal> is
+            <literal>NULL</literal> (which means <quote>unknown</quote>)
+            if the slave SQL thread is not running, or if the slave I/O
+            thread is not running or not connected to master. For
+            example if the slave I/O thread is sleeping for the number
+            of seconds given by the <literal>CHANGE MASTER TO</literal>
+            statement or <option>--master-connect-retry</option> option
+            (default 60) before reconnecting, <literal>NULL</literal> is
+            shown, as the slave cannot know what the master is doing,
+            and so cannot say reliably how late it is.
+          </para>
+
+          <para>
+            This field has one limitation. The timestamp is preserved
+            through replication, which means that, if a master M1 is
+            itself a slave of M0, any event from M1's binlog which
+            originates in replicating an event from M0's binlog has the
+            timestamp of that event. This enables MySQL to replicate
+            <literal>TIMESTAMP</literal> successfully. However, the
+            drawback for <literal>Seconds_Behind_Master</literal> is
+            that if M1 also receives direct updates from clients, the
+            value randomly deviates, because sometimes the last M1's
+            event is from M0 and sometimes it is the most recent
+            timestamp from a direct update.
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+    </section>
+
     <section id="show-status">
 
       <title><literal>SHOW STATUS</literal> Syntax</title>


Modified: trunk/refman-5.0/Makefile.depends
===================================================================
--- trunk/refman-5.0/Makefile.depends	2008-07-24 05:09:52 UTC (rev 11340)
+++ trunk/refman-5.0/Makefile.depends	2008-07-24 07:39:10 UTC (rev 11341)
Changed blocks: 2, Lines Added: 2, Lines Deleted: 3; 1301 bytes

@@ -3348,10 +3348,7 @@
 sql_syntax_replication_IDMAPS = \
 	../refman-5.0/metadata/dba-core.idmap \
 	../refman-5.0/metadata/functions-core.idmap \
-	../refman-5.0/metadata/programs-admin-util-core.idmap \
 	../refman-5.0/metadata/replication-configuration.idmap \
-	../refman-5.0/metadata/replication-implementation.idmap \
-	../refman-5.0/metadata/sql-syntax-data-manipulation.idmap \
 	../refman-5.0/metadata/sql-syntax-replication.idmap \
 	../refman-5.0/metadata/sql-syntax-server-administration.idmap
 sql-syntax-replication.validpure: $(sql_syntax_replication_SOURCES)

@@ -3382,7 +3379,9 @@
 	../refman-5.0/metadata/internationalization.idmap \
 	../refman-5.0/metadata/language-structure-core.idmap \
 	../refman-5.0/metadata/optimization.idmap \
+	../refman-5.0/metadata/programs-admin-util-core.idmap \
 	../refman-5.0/metadata/programs-installation.idmap \
+	../refman-5.0/metadata/replication-implementation.idmap \
 	../refman-5.0/metadata/restrictions.idmap \
 	../refman-5.0/metadata/se-archive.idmap \
 	../refman-5.0/metadata/se-innodb-core.idmap \


Modified: trunk/refman-5.0/sql-syntax-replication.xml
===================================================================
--- trunk/refman-5.0/sql-syntax-replication.xml	2008-07-24 05:09:52 UTC (rev 11340)
+++ trunk/refman-5.0/sql-syntax-replication.xml	2008-07-24 07:39:10 UTC (rev 11341)
Changed blocks: 4, Lines Added: 42, Lines Deleted: 770; 25568 bytes

@@ -39,6 +39,42 @@
       statements for managing slave servers.
     </para>
 
+    <para>
+      The following <literal>SHOW</literal> statements are used with
+      master servers in replication:
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
+            <literal>SHOW BINARY LOGS</literal>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>SHOW BINLOG EVENTS</literal>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>SHOW MASTER STATUS</literal>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>SHOW SLAVE HOSTS</literal>
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+      For information about these statements, see
+      <xref linkend="show"/>.
+    </para>
+
     <section id="purge-master-logs">
 
       <title><literal>PURGE MASTER LOGS</literal> Syntax</title>

@@ -240,259 +276,6 @@
 
     </section>
 
-    <section id="show-binlog-events">
-
-      <title><literal>SHOW BINLOG EVENTS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW BINLOG EVENTS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW BINLOG EVENTS"/>
-
-      <remark role="help-keywords">
-        SHOW BINLOG EVENTS LIMIT FROM IN
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW BINLOG EVENTS
-   [IN '<replaceable>log_name</replaceable>'] [FROM <replaceable>pos</replaceable>] [LIMIT [<replaceable>offset</replaceable>,] <replaceable>row_count</replaceable>]
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Shows the events in the binary log. If you do not specify
-        <literal>'<replaceable>log_name</replaceable>'</literal>, the
-        first binary log is displayed.
-      </para>
-
-      <remark role="help-description-end"/>
-
-      <para>
-        The <literal>LIMIT</literal> clause has the same syntax as for
-        the <literal>SELECT</literal> statement. See
-        <xref linkend="select"/>.
-      </para>
-
-      <note>
-        <para>
-          Issuing a <literal>SHOW BINLOG EVENTS</literal> with no
-          <literal>LIMIT</literal> clause could start a very time- and
-          resource-consuming process because the server returns to the
-          client the complete contents of the binary log (which includes
-          all statements executed by the server that modify data). As an
-          alternative to <literal>SHOW BINLOG EVENTS</literal>, use the
-          <command>mysqlbinlog</command> utility to save the binary log
-          to a text file for later examination and analysis. See
-          <xref linkend="mysqlbinlog"/>.
-        </para>
-      </note>
-
-      <note>
-        <para>
-          Events relating to the setting of variables are not included
-          in the output from <literal>SHOW BINLOG EVENTS</literal>. To
-          get complete coverage of events within a binary log, use
-          <link linkend="mysqlbinlog"><literal>mysqlbinlog</literal></link>.
-        </para>
-      </note>
-
-    </section>
-
-    <section id="show-binary-logs">
-
-      <title><literal>SHOW BINARY LOGS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW BINARY LOGS</primary>
-      </indexterm>
-
-      <indexterm>
-        <primary>SHOW MASTER LOGS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW BINARY LOGS"/>
-
-      <remark role="help-keywords">
-        SHOW BINARY MASTER LOGS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW BINARY LOGS
-SHOW MASTER LOGS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Lists the binary log files on the server. This statement is used
-        as part of the procedure described in
-        <xref linkend="purge-master-logs"/>, that shows how to determine
-        which logs can be purged.
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW BINARY LOGS;</userinput>
-+---------------+-----------+
-| Log_name      | File_size |
-+---------------+-----------+
-| binlog.000015 |    724935 |
-| binlog.000016 |    733481 |
-+---------------+-----------+
-</programlisting>
-
-      <remark role="help-description-end"/>
-
-      <para>
-        <literal>SHOW MASTER LOGS</literal> is equivalent to
-        <literal>SHOW BINARY LOGS</literal>. The
-        <literal>File_size</literal> column is displayed as of MySQL
-        5.0.7.
-      </para>
-
-    </section>
-
-    <section id="show-master-status">
-
-      <title><literal>SHOW MASTER STATUS</literal> Syntax</title>
-
-      <remark role="todo">
-        describe output
-      </remark>
-
-      <indexterm>
-        <primary>SHOW MASTER STATUS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW MASTER STATUS"/>
-
-      <remark role="help-keywords">
-        SHOW MASTER STATUS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW MASTER STATUS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Provides status information about the binary log files of the
-        master. Example:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW MASTER STATUS;</userinput>
-+---------------+----------+--------------+------------------+
-| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB |
-+---------------+----------+--------------+------------------+
-| mysql-bin.003 | 73       | test         | manual,mysql     |
-+---------------+----------+--------------+------------------+
-</programlisting>
-
-      <remark role="help-description-end"/>
-
-    </section>
-
-    <section id="show-slave-hosts">
-
-      <title><literal>SHOW SLAVE HOSTS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW SLAVE HOSTS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW SLAVE HOSTS"/>
-
-      <remark role="help-keywords">
-        SHOW SLAVE HOSTS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW SLAVE HOSTS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Displays a list of replication slaves currently registered with
-        the master. Only slaves started with the
-        <option>--report-host=<replaceable>slave_name</replaceable></option>
-        option are visible in this list.
-      </para>
-
-      <para>
-        The list is displayed on any server (not just the master
-        server). The output looks like this:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW SLAVE HOSTS</userinput>;
-+------------+-----------+------+-----------+
-| Server_id  | Host      | Port | Master_id |
-+------------+-----------+------+-----------+
-|  192168010 | iconnect2 | 3306 | 192168011 |
-| 1921680101 | athena    | 3306 | 192168011 |
-+------------+-----------+------+-----------+
-</programlisting>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal>Server_id</literal>: The unique server ID of the
-            slave server, as configured in the server's option file, or
-            on the command line with
-            <option>--server-id=<replaceable>value</replaceable></option>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Host</literal>: The host name of the slave server,
-            as configured in the server's option file, or on the command
-            line with
-            <option>--report-host=<replaceable>value</replaceable></option>.
-            Note that this can differ from the machine name as
-            configured in the operating system.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Port</literal>: The port the slave server is
-            listening on.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_id</literal>: The unique server ID of the
-            master server that the slave server is replicating from.
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-      <para>
-        Some MySQL versions report another variable,
-        <literal>Rpl_recovery_rank</literal>. This variable was never
-        used, and was eventually removed.
-      </para>
-
-      <remark role="help-description-end"/>
-
-    </section>
-
   </section>
 
   <section id="replication-slave-sql">

@@ -521,6 +304,12 @@
       statements for managing master servers.
     </para>
 
+    <para>
+      <literal>SHOW SLAVE STATUS</literal> is also used with replication
+      slaves. For information about this statement, see
+      <xref linkend="show-slave-status"/>.
+    </para>
+
     <section id="change-master-to">
 
       <title><literal>CHANGE MASTER TO</literal> Syntax</title>

@@ -1089,523 +878,6 @@
 
     </section>
 
-    <section id="show-slave-status">
-
-      <title><literal>SHOW SLAVE STATUS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW SLAVE STATUS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW SLAVE STATUS"/>
-
-      <remark role="help-keywords">
-        SHOW SLAVE STATUS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW SLAVE STATUS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        This statement provides status information on essential
-        parameters of the slave threads. If you issue this statement
-        using the <command>mysql</command> client, you can use a
-        <literal>\G</literal> statement terminator rather than a
-        semicolon to obtain a more readable vertical layout:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW SLAVE STATUS\G</userinput>
-*************************** 1. row ***************************
-       Slave_IO_State: Waiting for master to send event
-          Master_Host: localhost
-          Master_User: root
-          Master_Port: 3306
-        Connect_Retry: 3
-      Master_Log_File: gbichot-bin.005
-  Read_Master_Log_Pos: 79
-       Relay_Log_File: gbichot-relay-bin.005
-        Relay_Log_Pos: 548
-Relay_Master_Log_File: gbichot-bin.005
-     Slave_IO_Running: Yes
-    Slave_SQL_Running: Yes
-      Replicate_Do_DB:
-  Replicate_Ignore_DB:
-           Last_Errno: 0
-           Last_Error:
-         Skip_Counter: 0
-  Exec_Master_Log_Pos: 79
-      Relay_Log_Space: 552
-      Until_Condition: None
-       Until_Log_File:
-        Until_Log_Pos: 0
-   Master_SSL_Allowed: No
-   Master_SSL_CA_File:
-   Master_SSL_CA_Path:
-      Master_SSL_Cert:
-    Master_SSL_Cipher:
-       Master_SSL_Key:
-Seconds_Behind_Master: 8
-</programlisting>
-
-      <remark role="help-description-end"/>
-
-      <para>
-        <literal>SHOW SLAVE STATUS</literal> returns the following
-        fields:
-      </para>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal>Slave_IO_State</literal>
-          </para>
-
-          <remark role="todo">
-            [js] What actually changed in 5.0.12?
-          </remark>
-
-          <para>
-            A copy of the <literal>State</literal> field of the output
-            of <literal>SHOW PROCESSLIST</literal> for the slave I/O
-            thread. This tells you what the thread is doing: trying to
-            connect to the master, waiting for events from the master,
-            reconnecting to the master, and so on. Possible states are
-            listed in
-            <xref linkend="replication-implementation-details"/>. It is
-            necessary to check this field for older versions of MySQL
-            (prior to 5.0.12) because in these versions the thread could
-            be running while unsuccessfully trying to connect to the
-            master; only this field makes you aware of the connection
-            problem. The state of the SQL thread is not copied because
-            it is simpler. If it is running, there is no problem; if it
-            is not, you can find the error in the
-            <literal>Last_Error</literal> field (described below).
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_Host</literal>
-          </para>
-
-          <para>
-            The current master host.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_User</literal>
-          </para>
-
-          <para>
-            The current user used to connect to the master.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_Port</literal>
-          </para>
-
-          <para>
-            The current master port.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Connect_Retry</literal>
-          </para>
-
-          <para>
-            The number of seconds between connect retries (default 60).
-            This may be set with the <literal>CHANGE MASTER TO</literal>
-            statement or <option>--master-connect-retry</option> option.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_Log_File</literal>
-          </para>
-
-          <para>
-            The name of the master binary log file from which the I/O
-            thread is currently reading.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Read_Master_Log_Pos</literal>
-          </para>
-
-          <para>
-            The position up to which the I/O thread has read in the
-            current master binary log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Log_File</literal>
-          </para>
-
-          <para>
-            The name of the relay log file from which the SQL thread is
-            currently reading and executing.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Log_Pos</literal>
-          </para>
-
-          <para>
-            The position up to which the SQL thread has read and
-            executed in the current relay log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Master_Log_File</literal>
-          </para>
-
-          <para>
-            The name of the master binary log file containing the most
-            recent event executed by the SQL thread.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Slave_IO_Running</literal>
-          </para>
-
-          <para>
-            Whether the I/O thread is started and has connected
-            successfully to the master. For older versions of MySQL
-            (prior to 4.1.14 and 5.0.12)
-            <literal>Slave_IO_Running</literal> is
-            <literal>YES</literal> if the I/O thread is started, even if
-            the slave hasn't connected to the master yet.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Slave_SQL_Running</literal>
-          </para>
-
-          <para>
-            Whether the SQL thread is started.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Replicate_Do_DB</literal>,
-            <literal>Replicate_Ignore_DB</literal>
-          </para>
-
-          <para>
-            The lists of databases that were specified with the
-            <option>--replicate-do-db</option> and
-            <option>--replicate-ignore-db</option> options, if any.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Replicate_Do_Table</literal>,
-            <literal>Replicate_Ignore_Table</literal>,
-            <literal>Replicate_Wild_Do_Table</literal>,
-            <literal>Replicate_Wild_Ignore_Table</literal>
-          </para>
-
-          <para>
-            The lists of tables that were specified with the
-            <option>--replicate-do-table</option>,
-            <option>--replicate-ignore-table</option>,
-            <option>--replicate-wild-do-table</option>, and
-            <option>--replicate-wild-ignore_table</option> options, if
-            any.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Last_Errno</literal>, <literal>Last_Error</literal>
-          </para>
-
-          <para>
-            The error number and error message returned by the most
-            recently executed statement. An error number of 0 and
-            message of the empty string mean <quote>no error.</quote> If
-            the <literal>Last_Error</literal> value is not empty, it
-            also appears as a message in the slave's error log. For
-            example:
-          </para>
-
-<programlisting>
-Last_Errno: 1051
-Last_Error: error 'Unknown table 'z'' on query 'drop table z'
-</programlisting>
-
-          <para>
-            The message indicates that the table <literal>z</literal>
-            existed on the master and was dropped there, but it did not
-            exist on the slave, so <literal>DROP TABLE</literal> failed
-            on the slave. (This might occur, for example, if you forget
-            to copy the table to the slave when setting up replication.)
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Skip_Counter</literal>
-          </para>
-
-          <para>
-            The most recently used value for
-            <literal>SQL_SLAVE_SKIP_COUNTER</literal>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Exec_Master_Log_Pos</literal>
-          </para>
-
-          <para>
-            The position of the last event executed by the SQL thread
-            from the master's binary log
-            (<literal>Relay_Master_Log_File</literal>).
-            (<literal>Relay_Master_Log_File</literal>,
-            <literal>Exec_Master_Log_Pos</literal>) in the master's
-            binary log corresponds to
-            (<literal>Relay_Log_File</literal>,
-            <literal>Relay_Log_Pos</literal>) in the relay log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Log_Space</literal>
-          </para>
-
-          <para>
-            The total combined size of all existing relay logs.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Until_Condition</literal>,
-            <literal>Until_Log_File</literal>,
-            <literal>Until_Log_Pos</literal>
-          </para>
-
-          <para>
-            The values specified in the <literal>UNTIL</literal> clause
-            of the <literal>START SLAVE</literal> statement.
-          </para>
-
-          <para>
-            <literal>Until_Condition</literal> has these values:
-          </para>
-
-          <itemizedlist>
-
-            <listitem>
-              <para>
-                <literal>None</literal> if no <literal>UNTIL</literal>
-                clause was specified
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>Master</literal> if the slave is reading until
-                a given position in the master's binary logs
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>Relay</literal> if the slave is reading until a
-                given position in its relay logs
-              </para>
-            </listitem>
-
-          </itemizedlist>
-
-          <para>
-            <literal>Until_Log_File</literal> and
-            <literal>Until_Log_Pos</literal> indicate the log filename
-            and position values that define the point at which the SQL
-            thread stops executing.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_SSL_Allowed</literal>,
-            <literal>Master_SSL_CA_File</literal>,
-            <literal>Master_SSL_CA_Path</literal>,
-            <literal>Master_SSL_Cert</literal>,
-            <literal>Master_SSL_Cipher</literal>,
-            <literal>Master_SSL_Key</literal>
-          </para>
-
-          <para>
-            These fields show the SSL parameters used by the slave to
-            connect to the master, if any.
-          </para>
-
-          <para>
-            <literal>Master_SSL_Allowed</literal> has these values:
-          </para>
-
-          <itemizedlist>
-
-            <listitem>
-              <para>
-                <literal>Yes</literal> if an SSL connection to the
-                master is permitted
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>No</literal> if an SSL connection to the master
-                is not permitted
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>Ignored</literal> if an SSL connection is
-                permitted but the slave server does not have SSL support
-                enabled
-              </para>
-            </listitem>
-
-          </itemizedlist>
-
-          <para>
-            The values of the other SSL-related fields correspond to the
-            values of the <literal>MASTER_SSL_CA</literal>,
-            <literal>MASTER_SSL_CAPATH</literal>,
-            <literal>MASTER_SSL_CERT</literal>,
-            <literal>MASTER_SSL_CIPHER</literal>, and
-            <literal>MASTER_SSL_KEY</literal> options to the
-            <literal>CHANGE MASTER</literal> statement. See
-            <xref linkend="change-master-to"/>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Seconds_Behind_Master</literal>
-          </para>
-
-          <para>
-            This field is an indication of how <quote>late</quote> the
-            slave is:
-          </para>
-
-          <itemizedlist>
-
-            <listitem>
-              <para>
-                When the slave SQL thread is actively running
-                (processing updates), this field is the number of
-                seconds that have elapsed since the timestamp of the
-                most recent event on the master executed by that thread.
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                When the SQL thread has caught up to the slave I/O
-                thread and goes idle waiting for more events from the
-                I/O thread, this field is zero.
-              </para>
-            </listitem>
-
-          </itemizedlist>
-
-          <para>
-            In essence, this field measures the time difference in
-            seconds between the slave SQL thread and the slave I/O
-            thread.
-          </para>
-
-          <remark role="todo">
-            How fast is &quot;fast&quot;?
-          </remark>
-
-          <para>
-            If the network connection between master and slave is fast,
-            the slave I/O thread is very close to the master, so this
-            field is a good approximation of how late the slave SQL
-            thread is compared to the master. If the network is slow,
-            this is <emphasis>not</emphasis> a good approximation; the
-            slave SQL thread may quite often be caught up with the
-            slow-reading slave I/O thread, so
-            <literal>Seconds_Behind_Master</literal> often shows a value
-            of 0, even if the I/O thread is late compared to the master.
-            In other words, <emphasis>this column is useful only for
-            fast networks</emphasis>.
-          </para>
-
-          <para>
-            This time difference computation works even though the
-            master and slave do not have identical clocks (the clock
-            difference is computed when the slave I/O thread starts, and
-            assumed to remain constant from then on).
-            <literal>Seconds_Behind_Master</literal> is
-            <literal>NULL</literal> (which means <quote>unknown</quote>)
-            if the slave SQL thread is not running, or if the slave I/O
-            thread is not running or not connected to master. For
-            example if the slave I/O thread is sleeping for the number
-            of seconds given by the <literal>CHANGE MASTER TO</literal>
-            statement or <option>--master-connect-retry</option> option
-            (default 60) before reconnecting, <literal>NULL</literal> is
-            shown, as the slave cannot know what the master is doing,
-            and so cannot say reliably how late it is.
-          </para>
-
-          <para>
-            This field has one limitation. The timestamp is preserved
-            through replication, which means that, if a master M1 is
-            itself a slave of M0, any event from M1's binlog which
-            originates in replicating an event from M0's binlog has the
-            timestamp of that event. This enables MySQL to replicate
-            <literal>TIMESTAMP</literal> successfully. However, the
-            drawback for <literal>Seconds_Behind_Master</literal> is
-            that if M1 also receives direct updates from clients, the
-            value randomly deviates, because sometimes the last M1's
-            event is from M0 and sometimes it is the most recent
-            timestamp from a direct update.
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-    </section>
-
     <section id="start-slave">
 
       <title><literal>START SLAVE</literal> Syntax</title>


Modified: trunk/refman-5.0/sql-syntax-server-administration.xml
===================================================================
--- trunk/refman-5.0/sql-syntax-server-administration.xml	2008-07-24 05:09:52 UTC (rev 11340)
+++ trunk/refman-5.0/sql-syntax-server-administration.xml	2008-07-24 07:39:10 UTC (rev 11341)
Changed blocks: 4, Lines Added: 770, Lines Deleted: 14; 25119 bytes

@@ -3547,20 +3547,6 @@
     </indexterm>
 
     <para>
-      The <literal>SHOW</literal> statement also has forms that provide
-      information about replication master and slave servers and are
-      described in <xref linkend="sql-syntax-replication"/>:
-    </para>
-
-<programlisting>
-SHOW BINARY LOGS
-SHOW BINLOG EVENTS
-SHOW MASTER STATUS
-SHOW SLAVE HOSTS
-SHOW SLAVE STATUS
-</programlisting>
-
-    <para>
       If the syntax for a given <literal>SHOW</literal> statement
       includes a <function role="sqlop" condition="like">LIKE
       '<replaceable>pattern</replaceable>'</function> part,

@@ -3593,6 +3579,123 @@
       <xref linkend="information-schema"/>.
     </para>
 
+    <section id="show-binary-logs">
+
+      <title><literal>SHOW BINARY LOGS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW BINARY LOGS</primary>
+      </indexterm>
+
+      <indexterm>
+        <primary>SHOW MASTER LOGS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW BINARY LOGS"/>
+
+      <remark role="help-keywords">
+        SHOW BINARY MASTER LOGS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW BINARY LOGS
+SHOW MASTER LOGS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Lists the binary log files on the server. This statement is used
+        as part of the procedure described in
+        <xref linkend="purge-master-logs"/>, that shows how to determine
+        which logs can be purged.
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW BINARY LOGS;</userinput>
++---------------+-----------+
+| Log_name      | File_size |
++---------------+-----------+
+| binlog.000015 |    724935 |
+| binlog.000016 |    733481 |
++---------------+-----------+
+</programlisting>
+
+      <remark role="help-description-end"/>
+
+      <para>
+        <literal>SHOW MASTER LOGS</literal> is equivalent to
+        <literal>SHOW BINARY LOGS</literal>. The
+        <literal>File_size</literal> column is displayed as of MySQL
+        5.0.7.
+      </para>
+
+    </section>
+
+    <section id="show-binlog-events">
+
+      <title><literal>SHOW BINLOG EVENTS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW BINLOG EVENTS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW BINLOG EVENTS"/>
+
+      <remark role="help-keywords">
+        SHOW BINLOG EVENTS LIMIT FROM IN
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW BINLOG EVENTS
+   [IN '<replaceable>log_name</replaceable>'] [FROM <replaceable>pos</replaceable>] [LIMIT [<replaceable>offset</replaceable>,] <replaceable>row_count</replaceable>]
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Shows the events in the binary log. If you do not specify
+        <literal>'<replaceable>log_name</replaceable>'</literal>, the
+        first binary log is displayed.
+      </para>
+
+      <remark role="help-description-end"/>
+
+      <para>
+        The <literal>LIMIT</literal> clause has the same syntax as for
+        the <literal>SELECT</literal> statement. See
+        <xref linkend="select"/>.
+      </para>
+
+      <note>
+        <para>
+          Issuing a <literal>SHOW BINLOG EVENTS</literal> with no
+          <literal>LIMIT</literal> clause could start a very time- and
+          resource-consuming process because the server returns to the
+          client the complete contents of the binary log (which includes
+          all statements executed by the server that modify data). As an
+          alternative to <literal>SHOW BINLOG EVENTS</literal>, use the
+          <command>mysqlbinlog</command> utility to save the binary log
+          to a text file for later examination and analysis. See
+          <xref linkend="mysqlbinlog"/>.
+        </para>
+      </note>
+
+      <note>
+        <para>
+          Events relating to the setting of variables are not included
+          in the output from <literal>SHOW BINLOG EVENTS</literal>. To
+          get complete coverage of events within a binary log, use
+          <link linkend="mysqlbinlog"><literal>mysqlbinlog</literal></link>.
+        </para>
+      </note>
+
+    </section>
+
     <section id="show-character-set">
 
       <title><literal>SHOW CHARACTER SET</literal> Syntax</title>

@@ -5098,6 +5201,50 @@
 
     </section>
 
+    <section id="show-master-status">
+
+      <title><literal>SHOW MASTER STATUS</literal> Syntax</title>
+
+      <remark role="todo">
+        describe output
+      </remark>
+
+      <indexterm>
+        <primary>SHOW MASTER STATUS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW MASTER STATUS"/>
+
+      <remark role="help-keywords">
+        SHOW MASTER STATUS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW MASTER STATUS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Provides status information about the binary log files of the
+        master. Example:
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW MASTER STATUS;</userinput>
++---------------+----------+--------------+------------------+
+| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB |
++---------------+----------+--------------+------------------+
+| mysql-bin.003 | 73       | test         | manual,mysql     |
++---------------+----------+--------------+------------------+
+</programlisting>
+
+      <remark role="help-description-end"/>
+
+    </section>
+
     <section id="show-mutex-status">
 
       <title><literal>SHOW MUTEX STATUS</literal> Syntax</title>

@@ -6186,6 +6333,615 @@
 
     </section>
 
+    <section id="show-slave-hosts">
+
+      <title><literal>SHOW SLAVE HOSTS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW SLAVE HOSTS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW SLAVE HOSTS"/>
+
+      <remark role="help-keywords">
+        SHOW SLAVE HOSTS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW SLAVE HOSTS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Displays a list of replication slaves currently registered with
+        the master. Only slaves started with the
+        <option>--report-host=<replaceable>slave_name</replaceable></option>
+        option are visible in this list.
+      </para>
+
+      <para>
+        The list is displayed on any server (not just the master
+        server). The output looks like this:
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW SLAVE HOSTS</userinput>;
++------------+-----------+------+-----------+
+| Server_id  | Host      | Port | Master_id |
++------------+-----------+------+-----------+
+|  192168010 | iconnect2 | 3306 | 192168011 |
+| 1921680101 | athena    | 3306 | 192168011 |
++------------+-----------+------+-----------+
+</programlisting>
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
+            <literal>Server_id</literal>: The unique server ID of the
+            slave server, as configured in the server's option file, or
+            on the command line with
+            <option>--server-id=<replaceable>value</replaceable></option>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Host</literal>: The host name of the slave server,
+            as configured in the server's option file, or on the command
+            line with
+            <option>--report-host=<replaceable>value</replaceable></option>.
+            Note that this can differ from the machine name as
+            configured in the operating system.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Port</literal>: The port the slave server is
+            listening on.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_id</literal>: The unique server ID of the
+            master server that the slave server is replicating from.
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+      <para>
+        Some MySQL versions report another variable,
+        <literal>Rpl_recovery_rank</literal>. This variable was never
+        used, and was eventually removed.
+      </para>
+
+      <remark role="help-description-end"/>
+
+    </section>
+
+    <section id="show-slave-status">
+
+      <title><literal>SHOW SLAVE STATUS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW SLAVE STATUS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW SLAVE STATUS"/>
+
+      <remark role="help-keywords">
+        SHOW SLAVE STATUS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW SLAVE STATUS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        This statement provides status information on essential
+        parameters of the slave threads. If you issue this statement
+        using the <command>mysql</command> client, you can use a
+        <literal>\G</literal> statement terminator rather than a
+        semicolon to obtain a more readable vertical layout:
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW SLAVE STATUS\G</userinput>
+*************************** 1. row ***************************
+       Slave_IO_State: Waiting for master to send event
+          Master_Host: localhost
+          Master_User: root
+          Master_Port: 3306
+        Connect_Retry: 3
+      Master_Log_File: gbichot-bin.005
+  Read_Master_Log_Pos: 79
+       Relay_Log_File: gbichot-relay-bin.005
+        Relay_Log_Pos: 548
+Relay_Master_Log_File: gbichot-bin.005
+     Slave_IO_Running: Yes
+    Slave_SQL_Running: Yes
+      Replicate_Do_DB:
+  Replicate_Ignore_DB:
+           Last_Errno: 0
+           Last_Error:
+         Skip_Counter: 0
+  Exec_Master_Log_Pos: 79
+      Relay_Log_Space: 552
+      Until_Condition: None
+       Until_Log_File:
+        Until_Log_Pos: 0
+   Master_SSL_Allowed: No
+   Master_SSL_CA_File:
+   Master_SSL_CA_Path:
+      Master_SSL_Cert:
+    Master_SSL_Cipher:
+       Master_SSL_Key:
+Seconds_Behind_Master: 8
+</programlisting>
+
+      <remark role="help-description-end"/>
+
+      <para>
+        <literal>SHOW SLAVE STATUS</literal> returns the following
+        fields:
+      </para>
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
+            <literal>Slave_IO_State</literal>
+          </para>
+
+          <remark role="todo">
+            [js] What actually changed in 5.0.12?
+          </remark>
+
+          <para>
+            A copy of the <literal>State</literal> field of the output
+            of <literal>SHOW PROCESSLIST</literal> for the slave I/O
+            thread. This tells you what the thread is doing: trying to
+            connect to the master, waiting for events from the master,
+            reconnecting to the master, and so on. Possible states are
+            listed in
+            <xref linkend="replication-implementation-details"/>. It is
+            necessary to check this field for older versions of MySQL
+            (prior to 5.0.12) because in these versions the thread could
+            be running while unsuccessfully trying to connect to the
+            master; only this field makes you aware of the connection
+            problem. The state of the SQL thread is not copied because
+            it is simpler. If it is running, there is no problem; if it
+            is not, you can find the error in the
+            <literal>Last_Error</literal> field (described below).
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_Host</literal>
+          </para>
+
+          <para>
+            The current master host.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_User</literal>
+          </para>
+
+          <para>
+            The current user used to connect to the master.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_Port</literal>
+          </para>
+
+          <para>
+            The current master port.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Connect_Retry</literal>
+          </para>
+
+          <para>
+            The number of seconds between connect retries (default 60).
+            This may be set with the <literal>CHANGE MASTER TO</literal>
+            statement or <option>--master-connect-retry</option> option.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_Log_File</literal>
+          </para>
+
+          <para>
+            The name of the master binary log file from which the I/O
+            thread is currently reading.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Read_Master_Log_Pos</literal>
+          </para>
+
+          <para>
+            The position up to which the I/O thread has read in the
+            current master binary log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Log_File</literal>
+          </para>
+
+          <para>
+            The name of the relay log file from which the SQL thread is
+            currently reading and executing.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Log_Pos</literal>
+          </para>
+
+          <para>
+            The position up to which the SQL thread has read and
+            executed in the current relay log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Master_Log_File</literal>
+          </para>
+
+          <para>
+            The name of the master binary log file containing the most
+            recent event executed by the SQL thread.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Slave_IO_Running</literal>
+          </para>
+
+          <para>
+            Whether the I/O thread is started and has connected
+            successfully to the master. For older versions of MySQL
+            (prior to 4.1.14 and 5.0.12)
+            <literal>Slave_IO_Running</literal> is
+            <literal>YES</literal> if the I/O thread is started, even if
+            the slave hasn't connected to the master yet.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Slave_SQL_Running</literal>
+          </para>
+
+          <para>
+            Whether the SQL thread is started.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Replicate_Do_DB</literal>,
+            <literal>Replicate_Ignore_DB</literal>
+          </para>
+
+          <para>
+            The lists of databases that were specified with the
+            <option>--replicate-do-db</option> and
+            <option>--replicate-ignore-db</option> options, if any.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Replicate_Do_Table</literal>,
+            <literal>Replicate_Ignore_Table</literal>,
+            <literal>Replicate_Wild_Do_Table</literal>,
+            <literal>Replicate_Wild_Ignore_Table</literal>
+          </para>
+
+          <para>
+            The lists of tables that were specified with the
+            <option>--replicate-do-table</option>,
+            <option>--replicate-ignore-table</option>,
+            <option>--replicate-wild-do-table</option>, and
+            <option>--replicate-wild-ignore_table</option> options, if
+            any.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Last_Errno</literal>, <literal>Last_Error</literal>
+          </para>
+
+          <para>
+            The error number and error message returned by the most
+            recently executed statement. An error number of 0 and
+            message of the empty string mean <quote>no error.</quote> If
+            the <literal>Last_Error</literal> value is not empty, it
+            also appears as a message in the slave's error log. For
+            example:
+          </para>
+
+<programlisting>
+Last_Errno: 1051
+Last_Error: error 'Unknown table 'z'' on query 'drop table z'
+</programlisting>
+
+          <para>
+            The message indicates that the table <literal>z</literal>
+            existed on the master and was dropped there, but it did not
+            exist on the slave, so <literal>DROP TABLE</literal> failed
+            on the slave. (This might occur, for example, if you forget
+            to copy the table to the slave when setting up replication.)
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Skip_Counter</literal>
+          </para>
+
+          <para>
+            The most recently used value for
+            <literal>SQL_SLAVE_SKIP_COUNTER</literal>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Exec_Master_Log_Pos</literal>
+          </para>
+
+          <para>
+            The position of the last event executed by the SQL thread
+            from the master's binary log
+            (<literal>Relay_Master_Log_File</literal>).
+            (<literal>Relay_Master_Log_File</literal>,
+            <literal>Exec_Master_Log_Pos</literal>) in the master's
+            binary log corresponds to
+            (<literal>Relay_Log_File</literal>,
+            <literal>Relay_Log_Pos</literal>) in the relay log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Log_Space</literal>
+          </para>
+
+          <para>
+            The total combined size of all existing relay logs.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Until_Condition</literal>,
+            <literal>Until_Log_File</literal>,
+            <literal>Until_Log_Pos</literal>
+          </para>
+
+          <para>
+            The values specified in the <literal>UNTIL</literal> clause
+            of the <literal>START SLAVE</literal> statement.
+          </para>
+
+          <para>
+            <literal>Until_Condition</literal> has these values:
+          </para>
+
+          <itemizedlist>
+
+            <listitem>
+              <para>
+                <literal>None</literal> if no <literal>UNTIL</literal>
+                clause was specified
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>Master</literal> if the slave is reading until
+                a given position in the master's binary logs
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>Relay</literal> if the slave is reading until a
+                given position in its relay logs
+              </para>
+            </listitem>
+
+          </itemizedlist>
+
+          <para>
+            <literal>Until_Log_File</literal> and
+            <literal>Until_Log_Pos</literal> indicate the log filename
+            and position values that define the point at which the SQL
+            thread stops executing.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_SSL_Allowed</literal>,
+            <literal>Master_SSL_CA_File</literal>,
+            <literal>Master_SSL_CA_Path</literal>,
+            <literal>Master_SSL_Cert</literal>,
+            <literal>Master_SSL_Cipher</literal>,
+            <literal>Master_SSL_Key</literal>
+          </para>
+
+          <para>
+            These fields show the SSL parameters used by the slave to
+            connect to the master, if any.
+          </para>
+
+          <para>
+            <literal>Master_SSL_Allowed</literal> has these values:
+          </para>
+
+          <itemizedlist>
+
+            <listitem>
+              <para>
+                <literal>Yes</literal> if an SSL connection to the
+                master is permitted
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>No</literal> if an SSL connection to the master
+                is not permitted
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>Ignored</literal> if an SSL connection is
+                permitted but the slave server does not have SSL support
+                enabled
+              </para>
+            </listitem>
+
+          </itemizedlist>
+
+          <para>
+            The values of the other SSL-related fields correspond to the
+            values of the <literal>MASTER_SSL_CA</literal>,
+            <literal>MASTER_SSL_CAPATH</literal>,
+            <literal>MASTER_SSL_CERT</literal>,
+            <literal>MASTER_SSL_CIPHER</literal>, and
+            <literal>MASTER_SSL_KEY</literal> options to the
+            <literal>CHANGE MASTER</literal> statement. See
+            <xref linkend="change-master-to"/>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Seconds_Behind_Master</literal>
+          </para>
+
+          <para>
+            This field is an indication of how <quote>late</quote> the
+            slave is:
+          </para>
+
+          <itemizedlist>
+
+            <listitem>
+              <para>
+                When the slave SQL thread is actively running
+                (processing updates), this field is the number of
+                seconds that have elapsed since the timestamp of the
+                most recent event on the master executed by that thread.
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                When the SQL thread has caught up to the slave I/O
+                thread and goes idle waiting for more events from the
+                I/O thread, this field is zero.
+              </para>
+            </listitem>
+
+          </itemizedlist>
+
+          <para>
+            In essence, this field measures the time difference in
+            seconds between the slave SQL thread and the slave I/O
+            thread.
+          </para>
+
+          <remark role="todo">
+            How fast is &quot;fast&quot;?
+          </remark>
+
+          <para>
+            If the network connection between master and slave is fast,
+            the slave I/O thread is very close to the master, so this
+            field is a good approximation of how late the slave SQL
+            thread is compared to the master. If the network is slow,
+            this is <emphasis>not</emphasis> a good approximation; the
+            slave SQL thread may quite often be caught up with the
+            slow-reading slave I/O thread, so
+            <literal>Seconds_Behind_Master</literal> often shows a value
+            of 0, even if the I/O thread is late compared to the master.
+            In other words, <emphasis>this column is useful only for
+            fast networks</emphasis>.
+          </para>
+
+          <para>
+            This time difference computation works even though the
+            master and slave do not have identical clocks (the clock
+            difference is computed when the slave I/O thread starts, and
+            assumed to remain constant from then on).
+            <literal>Seconds_Behind_Master</literal> is
+            <literal>NULL</literal> (which means <quote>unknown</quote>)
+            if the slave SQL thread is not running, or if the slave I/O
+            thread is not running or not connected to master. For
+            example if the slave I/O thread is sleeping for the number
+            of seconds given by the <literal>CHANGE MASTER TO</literal>
+            statement or <option>--master-connect-retry</option> option
+            (default 60) before reconnecting, <literal>NULL</literal> is
+            shown, as the slave cannot know what the master is doing,
+            and so cannot say reliably how late it is.
+          </para>
+
+          <para>
+            This field has one limitation. The timestamp is preserved
+            through replication, which means that, if a master M1 is
+            itself a slave of M0, any event from M1's binlog which
+            originates in replicating an event from M0's binlog has the
+            timestamp of that event. This enables MySQL to replicate
+            <literal>TIMESTAMP</literal> successfully. However, the
+            drawback for <literal>Seconds_Behind_Master</literal> is
+            that if M1 also receives direct updates from clients, the
+            value randomly deviates, because sometimes the last M1's
+            event is from M0 and sometimes it is the most recent
+            timestamp from a direct update.
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+    </section>
+
     <section id="show-status">
 
       <title><literal>SHOW STATUS</literal> Syntax</title>


Modified: trunk/refman-5.1/Makefile.depends
===================================================================
--- trunk/refman-5.1/Makefile.depends	2008-07-24 05:09:52 UTC (rev 11340)
+++ trunk/refman-5.1/Makefile.depends	2008-07-24 07:39:10 UTC (rev 11341)
Changed blocks: 2, Lines Added: 2, Lines Deleted: 3; 1340 bytes

@@ -3296,10 +3296,7 @@
 sql_syntax_replication_IDMAPS = \
 	../refman-5.1/metadata/dba-core.idmap \
 	../refman-5.1/metadata/functions-core.idmap \
-	../refman-5.1/metadata/programs-admin-util-core.idmap \
 	../refman-5.1/metadata/replication-configuration.idmap \
-	../refman-5.1/metadata/replication-implementation.idmap \
-	../refman-5.1/metadata/sql-syntax-data-manipulation.idmap \
 	../refman-5.1/metadata/sql-syntax-replication.idmap \
 	../refman-5.1/metadata/sql-syntax-server-administration.idmap
 sql-syntax-replication.validpure: $(sql_syntax_replication_SOURCES)

@@ -3335,8 +3332,10 @@
 	../refman-5.1/metadata/news-5.1-core.idmap \
 	../refman-5.1/metadata/optimization.idmap \
 	../refman-5.1/metadata/partitioning.idmap \
+	../refman-5.1/metadata/programs-admin-util-core.idmap \
 	../refman-5.1/metadata/programs-client-core.idmap \
 	../refman-5.1/metadata/programs-installation.idmap \
+	../refman-5.1/metadata/replication-implementation.idmap \
 	../refman-5.1/metadata/replication-notes.idmap \
 	../refman-5.1/metadata/restrictions.idmap \
 	../refman-5.1/metadata/se-archive.idmap \


Modified: trunk/refman-5.1/sql-syntax-replication.xml
===================================================================
--- trunk/refman-5.1/sql-syntax-replication.xml	2008-07-24 05:09:52 UTC (rev 11340)
+++ trunk/refman-5.1/sql-syntax-replication.xml	2008-07-24 07:39:10 UTC (rev 11341)
Changed blocks: 4, Lines Added: 42, Lines Deleted: 813; 27344 bytes

@@ -39,6 +39,42 @@
       statements for managing slave servers.
     </para>
 
+    <para>
+      The following <literal>SHOW</literal> statements are used with
+      master servers in replication:
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
+            <literal>SHOW BINARY LOGS</literal>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>SHOW BINLOG EVENTS</literal>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>SHOW MASTER STATUS</literal>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>SHOW SLAVE HOSTS</literal>
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+      For information about these statements, see
+      <xref linkend="show"/>.
+    </para>
+
     <section id="purge-master-logs">
 
       <title><literal>PURGE MASTER LOGS</literal> Syntax</title>

@@ -240,257 +276,6 @@
 
     </section>
 
-    <section id="show-binlog-events">
-
-      <title><literal>SHOW BINLOG EVENTS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW BINLOG EVENTS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW BINLOG EVENTS"/>
-
-      <remark role="help-keywords">
-        SHOW BINLOG EVENTS LIMIT FROM IN
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW BINLOG EVENTS
-   [IN '<replaceable>log_name</replaceable>'] [FROM <replaceable>pos</replaceable>] [LIMIT [<replaceable>offset</replaceable>,] <replaceable>row_count</replaceable>]
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Shows the events in the binary log. If you do not specify
-        <literal>'<replaceable>log_name</replaceable>'</literal>, the
-        first binary log is displayed.
-      </para>
-
-      <remark role="help-description-end"/>
-
-      <para>
-        The <literal>LIMIT</literal> clause has the same syntax as for
-        the <literal>SELECT</literal> statement. See
-        <xref linkend="select"/>.
-      </para>
-
-      <note>
-        <para>
-          Issuing a <literal>SHOW BINLOG EVENTS</literal> with no
-          <literal>LIMIT</literal> clause could start a very time- and
-          resource-consuming process because the server returns to the
-          client the complete contents of the binary log (which includes
-          all statements executed by the server that modify data). As an
-          alternative to <literal>SHOW BINLOG EVENTS</literal>, use the
-          <command>mysqlbinlog</command> utility to save the binary log
-          to a text file for later examination and analysis. See
-          <xref linkend="mysqlbinlog"/>.
-        </para>
-      </note>
-
-      <note>
-        <para>
-          Events relating to the setting of variables are not included
-          in the output from <literal>SHOW BINLOG EVENTS</literal>. To
-          get complete coverage of events within a binary log, use
-          <link linkend="mysqlbinlog"><literal>mysqlbinlog</literal></link>.
-        </para>
-      </note>
-
-    </section>
-
-    <section id="show-binary-logs">
-
-      <title><literal>SHOW BINARY LOGS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW BINARY LOGS</primary>
-      </indexterm>
-
-      <indexterm>
-        <primary>SHOW MASTER LOGS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW BINARY LOGS"/>
-
-      <remark role="help-keywords">
-        SHOW BINARY MASTER LOGS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW BINARY LOGS
-SHOW MASTER LOGS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Lists the binary log files on the server. This statement is used
-        as part of the procedure described in
-        <xref linkend="purge-master-logs"/>, that shows how to determine
-        which logs can be purged.
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW BINARY LOGS;</userinput>
-+---------------+-----------+
-| Log_name      | File_size |
-+---------------+-----------+
-| binlog.000015 |    724935 |
-| binlog.000016 |    733481 |
-+---------------+-----------+
-</programlisting>
-
-      <remark role="help-description-end"/>
-
-      <para>
-        <literal>SHOW MASTER LOGS</literal> is equivalent to
-        <literal>SHOW BINARY LOGS</literal>.
-      </para>
-
-    </section>
-
-    <section id="show-master-status">
-
-      <title><literal>SHOW MASTER STATUS</literal> Syntax</title>
-
-      <remark role="todo">
-        describe output
-      </remark>
-
-      <indexterm>
-        <primary>SHOW MASTER STATUS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW MASTER STATUS"/>
-
-      <remark role="help-keywords">
-        SHOW MASTER STATUS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW MASTER STATUS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Provides status information about the binary log files of the
-        master. Example:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW MASTER STATUS;</userinput>
-+---------------+----------+--------------+------------------+
-| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB |
-+---------------+----------+--------------+------------------+
-| mysql-bin.003 | 73       | test         | manual,mysql     |
-+---------------+----------+--------------+------------------+
-</programlisting>
-
-      <remark role="help-description-end"/>
-
-    </section>
-
-    <section id="show-slave-hosts">
-
-      <title><literal>SHOW SLAVE HOSTS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW SLAVE HOSTS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW SLAVE HOSTS"/>
-
-      <remark role="help-keywords">
-        SHOW SLAVE HOSTS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW SLAVE HOSTS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Displays a list of replication slaves currently registered with
-        the master. Only slaves started with the
-        <option>--report-host=<replaceable>slave_name</replaceable></option>
-        option are visible in this list.
-      </para>
-
-      <para>
-        The list is displayed on any server (not just the master
-        server). The output looks like this:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW SLAVE HOSTS</userinput>;
-+------------+-----------+------+-----------+
-| Server_id  | Host      | Port | Master_id |
-+------------+-----------+------+-----------+
-|  192168010 | iconnect2 | 3306 | 192168011 |
-| 1921680101 | athena    | 3306 | 192168011 |
-+------------+-----------+------+-----------+
-</programlisting>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal>Server_id</literal>: The unique server ID of the
-            slave server, as configured in the server's option file, or
-            on the command line with
-            <option>--server-id=<replaceable>value</replaceable></option>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Host</literal>: The host name of the slave server,
-            as configured in the server's option file, or on the command
-            line with
-            <option>--report-host=<replaceable>value</replaceable></option>.
-            Note that this can differ from the machine name as
-            configured in the operating system.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Port</literal>: The port the slave server is
-            listening on.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_id</literal>: The unique server ID of the
-            master server that the slave server is replicating from.
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-      <para>
-        Some MySQL versions report another variable,
-        <literal>Rpl_recovery_rank</literal>. This variable was never
-        used, and was eventually removed.
-      </para>
-
-      <remark role="help-description-end"/>
-
-    </section>
-
   </section>
 
   <section id="replication-slave-sql">

@@ -519,6 +304,12 @@
       statements for managing master servers.
     </para>
 
+    <para>
+      <literal>SHOW SLAVE STATUS</literal> is also used with replication
+      slaves. For information about this statement, see
+      <xref linkend="show-slave-status"/>.
+    </para>
+
     <section id="change-master-to">
 
       <title><literal>CHANGE MASTER TO</literal> Syntax</title>

@@ -1148,568 +939,6 @@
 
     </section>
 
-    <section id="show-slave-status">
-
-      <title><literal>SHOW SLAVE STATUS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW SLAVE STATUS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW SLAVE STATUS"/>
-
-      <remark role="help-keywords">
-        SHOW SLAVE STATUS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW SLAVE STATUS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        This statement provides status information on essential
-        parameters of the slave threads. If you issue this statement
-        using the <command>mysql</command> client, you can use a
-        <literal>\G</literal> statement terminator rather than a
-        semicolon to obtain a more readable vertical layout:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW SLAVE STATUS\G</userinput>
-*************************** 1. row ***************************
-               Slave_IO_State: Waiting for master to send event
-                  Master_Host: localhost
-                  Master_User: root
-                  Master_Port: 3306
-                Connect_Retry: 3
-              Master_Log_File: gbichot-bin.005
-          Read_Master_Log_Pos: 79
-               Relay_Log_File: gbichot-relay-bin.005
-                Relay_Log_Pos: 548
-        Relay_Master_Log_File: gbichot-bin.005
-             Slave_IO_Running: Yes
-            Slave_SQL_Running: Yes
-              Replicate_Do_DB:
-          Replicate_Ignore_DB:
-                   Last_Errno: 0
-                   Last_Error:
-                 Skip_Counter: 0
-          Exec_Master_Log_Pos: 79
-              Relay_Log_Space: 552
-              Until_Condition: None
-               Until_Log_File:
-                Until_Log_Pos: 0
-           Master_SSL_Allowed: No
-           Master_SSL_CA_File:
-           Master_SSL_CA_Path:
-              Master_SSL_Cert:
-            Master_SSL_Cipher:
-               Master_SSL_Key:
-        Seconds_Behind_Master: 8
-Master_SSL_Verify_Server_Cert: No
-                Last_IO_Errno: 0
-                Last_IO_Error:
-               Last_SQL_Errno: 0
-               Last_SQL_Error:
-</programlisting>
-
-      <remark role="help-description-end"/>
-
-      <para>
-        <literal>SHOW SLAVE STATUS</literal> returns the following
-        fields:
-      </para>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal>Slave_IO_State</literal>
-          </para>
-
-          <remark role="todo">
-            [js] What actually changed in 5.0.12? Need to have this para
-            reviewed...
-          </remark>
-
-          <para>
-            A copy of the <literal>State</literal> field of the output
-            of <literal>SHOW PROCESSLIST</literal> for the slave I/O
-            thread. This tells you what the thread is doing: trying to
-            connect to the master, waiting for events from the master,
-            reconnecting to the master, and so on. Possible states are
-            listed in
-            <xref linkend="replication-implementation-details"/>. It is
-            necessary to check this field for older versions of MySQL
-            which allowed the thread to continue running while
-            unsuccessfully trying to connect to the master. If it is
-            running, there is no problem; if it is not, you can find the
-            error in the <literal>Last_Error</literal> field (described
-            below).
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_Host</literal>
-          </para>
-
-          <para>
-            The current master host.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_User</literal>
-          </para>
-
-          <para>
-            The current user used to connect to the master.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_Port</literal>
-          </para>
-
-          <para>
-            The current master port.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Connect_Retry</literal>
-          </para>
-
-          <para>
-            The number of seconds between connect retries (default 60).
-            This may be set with the <literal>CHANGE MASTER TO</literal>
-            statement or <option>--master-connect-retry</option> option.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_Log_File</literal>
-          </para>
-
-          <para>
-            The name of the master binary log file from which the I/O
-            thread is currently reading.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Read_Master_Log_Pos</literal>
-          </para>
-
-          <para>
-            The position up to which the I/O thread has read in the
-            current master binary log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Log_File</literal>
-          </para>
-
-          <para>
-            The name of the relay log file from which the SQL thread is
-            currently reading and executing.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Log_Pos</literal>
-          </para>
-
-          <para>
-            The position up to which the SQL thread has read and
-            executed in the current relay log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Master_Log_File</literal>
-          </para>
-
-          <para>
-            The name of the master binary log file containing the most
-            recent event executed by the SQL thread.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Slave_IO_Running</literal>
-          </para>
-
-          <para>
-            Whether the I/O thread is started and has connected
-            successfully to the master. For older versions of MySQL
-            (prior to 4.1.14 and 5.0.12)
-            <literal>Slave_IO_Running</literal> is
-            <literal>YES</literal> if the I/O thread is started, even if
-            the slave hasn't connected to the master yet.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Slave_SQL_Running</literal>
-          </para>
-
-          <para>
-            Whether the SQL thread is started.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Replicate_Do_DB</literal>,
-            <literal>Replicate_Ignore_DB</literal>
-          </para>
-
-          <para>
-            The lists of databases that were specified with the
-            <option>--replicate-do-db</option> and
-            <option>--replicate-ignore-db</option> options, if any.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Replicate_Do_Table</literal>,
-            <literal>Replicate_Ignore_Table</literal>,
-            <literal>Replicate_Wild_Do_Table</literal>,
-            <literal>Replicate_Wild_Ignore_Table</literal>
-          </para>
-
-          <para>
-            The lists of tables that were specified with the
-            <option>--replicate-do-table</option>,
-            <option>--replicate-ignore-table</option>,
-            <option>--replicate-wild-do-table</option>, and
-            <option>--replicate-wild-ignore_table</option> options, if
-            any.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Last_Errno</literal>, <literal>Last_Error</literal>
-          </para>
-
-          <para>
-            As of MySQL 5.1.20, these columns are aliases for
-            <literal>Last_SQL_Errno</literal> and
-            <literal>Last_SQL_Error</literal>. Before 5.1.20, they
-            indicate the error number and error message returned by the
-            most recently executed statement. An error number of 0 and
-            message of the empty string mean <quote>no error.</quote> If
-            the <literal>Last_Error</literal> value is not empty, it
-            also appears as a message in the slave's error log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Skip_Counter</literal>
-          </para>
-
-          <para>
-            The most recently used value for
-            <literal>SQL_SLAVE_SKIP_COUNTER</literal>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Exec_Master_Log_Pos</literal>
-          </para>
-
-          <para>
-            The position of the last event executed by the SQL thread
-            from the master's binary log
-            (<literal>Relay_Master_Log_File</literal>).
-            (<literal>Relay_Master_Log_File</literal>,
-            <literal>Exec_Master_Log_Pos</literal>) in the master's
-            binary log corresponds to
-            (<literal>Relay_Log_File</literal>,
-            <literal>Relay_Log_Pos</literal>) in the relay log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Log_Space</literal>
-          </para>
-
-          <para>
-            The total combined size of all existing relay logs.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Until_Condition</literal>,
-            <literal>Until_Log_File</literal>,
-            <literal>Until_Log_Pos</literal>
-          </para>
-
-          <para>
-            The values specified in the <literal>UNTIL</literal> clause
-            of the <literal>START SLAVE</literal> statement.
-          </para>
-
-          <para>
-            <literal>Until_Condition</literal> has these values:
-          </para>
-
-          <itemizedlist>
-
-            <listitem>
-              <para>
-                <literal>None</literal> if no <literal>UNTIL</literal>
-                clause was specified
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>Master</literal> if the slave is reading until
-                a given position in the master's binary logs
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>Relay</literal> if the slave is reading until a
-                given position in its relay logs
-              </para>
-            </listitem>
-
-          </itemizedlist>
-
-          <para>
-            <literal>Until_Log_File</literal> and
-            <literal>Until_Log_Pos</literal> indicate the log filename
-            and position values that define the point at which the SQL
-            thread stops executing.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_SSL_Allowed</literal>,
-            <literal>Master_SSL_CA_File</literal>,
-            <literal>Master_SSL_CA_Path</literal>,
-            <literal>Master_SSL_Cert</literal>,
-            <literal>Master_SSL_Cipher</literal>,
-            <literal>Master_SSL_Key</literal>
-          </para>
-
-          <para>
-            These fields show the SSL parameters used by the slave to
-            connect to the master, if any.
-          </para>
-
-          <para>
-            <literal>Master_SSL_Allowed</literal> has these values:
-          </para>
-
-          <itemizedlist>
-
-            <listitem>
-              <para>
-                <literal>Yes</literal> if an SSL connection to the
-                master is permitted
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>No</literal> if an SSL connection to the master
-                is not permitted
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>Ignored</literal> if an SSL connection is
-                permitted but the slave server does not have SSL support
-                enabled
-              </para>
-            </listitem>
-
-          </itemizedlist>
-
-          <para>
-            The values of the other SSL-related fields correspond to the
-            values of the <literal>MASTER_SSL_CA</literal>,
-            <literal>MASTER_SSL_CAPATH</literal>,
-            <literal>MASTER_SSL_CERT</literal>,
-            <literal>MASTER_SSL_CIPHER</literal>,
-            <literal>MASTER_SSL_KEY</literal>, and
-            <literal>MASTER_SSL_VERIFY_SERVER_CERT</literal> options to
-            the <literal>CHANGE MASTER</literal> statement. See
-            <xref linkend="change-master-to"/>.
-            <literal>MASTER_SSL_VERIFY_SERVER_CERT</literal> was added
-            in MySQL 5.1.18.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Seconds_Behind_Master</literal>
-          </para>
-
-          <para>
-            This field is an indication of how <quote>late</quote> the
-            slave is:
-          </para>
-
-          <itemizedlist>
-
-            <listitem>
-              <para>
-                When the slave SQL thread is actively running
-                (processing updates), this field is the number of
-                seconds that have elapsed since the timestamp of the
-                most recent event on the master executed by that thread.
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                When the SQL thread has caught up to the slave I/O
-                thread and goes idle waiting for more events from the
-                I/O thread, this field is zero.
-              </para>
-            </listitem>
-
-          </itemizedlist>
-
-          <para>
-            In essence, this field measures the time difference in
-            seconds between the slave SQL thread and the slave I/O
-            thread.
-          </para>
-
-          <remark role="todo">
-            How fast is &quot;fast&quot;?
-          </remark>
-
-          <para>
-            If the network connection between master and slave is fast,
-            the slave I/O thread is very close to the master, so this
-            field is a good approximation of how late the slave SQL
-            thread is compared to the master. If the network is slow,
-            this is <emphasis>not</emphasis> a good approximation; the
-            slave SQL thread may quite often be caught up with the
-            slow-reading slave I/O thread, so
-            <literal>Seconds_Behind_Master</literal> often shows a value
-            of 0, even if the I/O thread is late compared to the master.
-            In other words, <emphasis>this column is useful only for
-            fast networks</emphasis>.
-          </para>
-
-          <para>
-            This time difference computation works even though the
-            master and slave do not have identical clocks (the clock
-            difference is computed when the slave I/O thread starts, and
-            assumed to remain constant from then on).
-            <literal>Seconds_Behind_Master</literal> is
-            <literal>NULL</literal> (which means <quote>unknown</quote>)
-            if the slave SQL thread is not running, or if the slave I/O
-            thread is not running or not connected to master. For
-            example if the slave I/O thread is sleeping for the number
-            of seconds given by the <literal>CHANGE MASTER TO</literal>
-            statement or <option>--master-connect-retry</option> option
-            (default 60) before reconnecting, <literal>NULL</literal> is
-            shown, as the slave cannot know what the master is doing,
-            and so cannot say reliably how late it is.
-          </para>
-
-          <para>
-            This field has one limitation. The timestamp is preserved
-            through replication, which means that, if a master M1 is
-            itself a slave of M0, any event from M1's binlog which
-            originates in replicating an event from M0's binlog has the
-            timestamp of that event. This enables MySQL to replicate
-            <literal>TIMESTAMP</literal> successfully. However, the
-            drawback for <literal>Seconds_Behind_Master</literal> is
-            that if M1 also receives direct updates from clients, the
-            value randomly deviates, because sometimes the last M1's
-            event is from M0 and sometimes it is the most recent
-            timestamp from a direct update.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Last_IO_Errno</literal>,
-            <literal>Last_IO_Error</literal>
-          </para>
-
-          <para>
-            The error number and error message of the last error that
-            caused the I/O thread to stop. An error number of 0 and
-            message of the empty string mean <quote>no error.</quote> If
-            the <literal>Last_IO_Error</literal> value is not empty, it
-            also appears as a message in the slave's error log. These
-            columns were added in MySQL 5.1.20.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Last_SQL_Errno</literal>,
-            <literal>Last_SQL_Error</literal>
-          </para>
-
-          <para>
-            The error number and error message of the last error that
-            caused the SQL thread to stop. An error number of 0 and
-            message of the empty string mean <quote>no error.</quote> If
-            the <literal>Last_IO_Error</literal> value is not empty, it
-            also appears as a message in the slave's error log. These
-            columns were added in MySQL 5.1.20.
-          </para>
-
-          <para>
-            Example:
-          </para>
-
-<programlisting>
-Last_SQL_Errno: 1051
-Last_SQL_Error: error 'Unknown table 'z'' on query 'drop table z'
-</programlisting>
-
-          <para>
-            The message indicates that the table <literal>z</literal>
-            existed on the master and was dropped there, but it did not
-            exist on the slave, so <literal>DROP TABLE</literal> failed
-            on the slave. (This might occur, for example, if you forget
-            to copy the table to the slave when setting up replication.)
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-    </section>
-
     <section id="start-slave">
 
       <title><literal>START SLAVE</literal> Syntax</title>


Modified: trunk/refman-5.1/sql-syntax-server-administration.xml
===================================================================
--- trunk/refman-5.1/sql-syntax-server-administration.xml	2008-07-24 05:09:52 UTC (rev 11340)
+++ trunk/refman-5.1/sql-syntax-server-administration.xml	2008-07-24 07:39:10 UTC (rev 11341)
Changed blocks: 4, Lines Added: 813, Lines Deleted: 14; 26853 bytes

@@ -3800,20 +3800,6 @@
     </indexterm>
 
     <para>
-      The <literal>SHOW</literal> statement also has forms that provide
-      information about replication master and slave servers and are
-      described in <xref linkend="sql-syntax-replication"/>:
-    </para>
-
-<programlisting>
-SHOW BINARY LOGS
-SHOW BINLOG EVENTS
-SHOW MASTER STATUS
-SHOW SLAVE HOSTS
-SHOW SLAVE STATUS
-</programlisting>
-
-    <para>
       If the syntax for a given <literal>SHOW</literal> statement
       includes a <function role="sqlop" condition="like">LIKE
       '<replaceable>pattern</replaceable>'</function> part,

@@ -3884,6 +3870,121 @@
 
     </section>
 
+    <section id="show-binary-logs">
+
+      <title><literal>SHOW BINARY LOGS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW BINARY LOGS</primary>
+      </indexterm>
+
+      <indexterm>
+        <primary>SHOW MASTER LOGS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW BINARY LOGS"/>
+
+      <remark role="help-keywords">
+        SHOW BINARY MASTER LOGS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW BINARY LOGS
+SHOW MASTER LOGS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Lists the binary log files on the server. This statement is used
+        as part of the procedure described in
+        <xref linkend="purge-master-logs"/>, that shows how to determine
+        which logs can be purged.
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW BINARY LOGS;</userinput>
++---------------+-----------+
+| Log_name      | File_size |
++---------------+-----------+
+| binlog.000015 |    724935 |
+| binlog.000016 |    733481 |
++---------------+-----------+
+</programlisting>
+
+      <remark role="help-description-end"/>
+
+      <para>
+        <literal>SHOW MASTER LOGS</literal> is equivalent to
+        <literal>SHOW BINARY LOGS</literal>.
+      </para>
+
+    </section>
+
+    <section id="show-binlog-events">
+
+      <title><literal>SHOW BINLOG EVENTS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW BINLOG EVENTS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW BINLOG EVENTS"/>
+
+      <remark role="help-keywords">
+        SHOW BINLOG EVENTS LIMIT FROM IN
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW BINLOG EVENTS
+   [IN '<replaceable>log_name</replaceable>'] [FROM <replaceable>pos</replaceable>] [LIMIT [<replaceable>offset</replaceable>,] <replaceable>row_count</replaceable>]
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Shows the events in the binary log. If you do not specify
+        <literal>'<replaceable>log_name</replaceable>'</literal>, the
+        first binary log is displayed.
+      </para>
+
+      <remark role="help-description-end"/>
+
+      <para>
+        The <literal>LIMIT</literal> clause has the same syntax as for
+        the <literal>SELECT</literal> statement. See
+        <xref linkend="select"/>.
+      </para>
+
+      <note>
+        <para>
+          Issuing a <literal>SHOW BINLOG EVENTS</literal> with no
+          <literal>LIMIT</literal> clause could start a very time- and
+          resource-consuming process because the server returns to the
+          client the complete contents of the binary log (which includes
+          all statements executed by the server that modify data). As an
+          alternative to <literal>SHOW BINLOG EVENTS</literal>, use the
+          <command>mysqlbinlog</command> utility to save the binary log
+          to a text file for later examination and analysis. See
+          <xref linkend="mysqlbinlog"/>.
+        </para>
+      </note>
+
+      <note>
+        <para>
+          Events relating to the setting of variables are not included
+          in the output from <literal>SHOW BINLOG EVENTS</literal>. To
+          get complete coverage of events within a binary log, use
+          <link linkend="mysqlbinlog"><literal>mysqlbinlog</literal></link>.
+        </para>
+      </note>
+
+    </section>
+
     <section id="show-character-set">
 
       <title><literal>SHOW CHARACTER SET</literal> Syntax</title>

@@ -6052,6 +6153,50 @@
 
     </section>
 
+    <section id="show-master-status">
+
+      <title><literal>SHOW MASTER STATUS</literal> Syntax</title>
+
+      <remark role="todo">
+        describe output
+      </remark>
+
+      <indexterm>
+        <primary>SHOW MASTER STATUS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW MASTER STATUS"/>
+
+      <remark role="help-keywords">
+        SHOW MASTER STATUS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW MASTER STATUS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Provides status information about the binary log files of the
+        master. Example:
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW MASTER STATUS;</userinput>
++---------------+----------+--------------+------------------+
+| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB |
++---------------+----------+--------------+------------------+
+| mysql-bin.003 | 73       | test         | manual,mysql     |
++---------------+----------+--------------+------------------+
+</programlisting>
+
+      <remark role="help-description-end"/>
+
+    </section>
+
     <section id="show-open-tables">
 
       <title><literal>SHOW OPEN TABLES</literal> Syntax</title>

@@ -6798,6 +6943,660 @@
 
     </section>
 
+    <section id="show-slave-hosts">
+
+      <title><literal>SHOW SLAVE HOSTS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW SLAVE HOSTS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW SLAVE HOSTS"/>
+
+      <remark role="help-keywords">
+        SHOW SLAVE HOSTS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW SLAVE HOSTS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Displays a list of replication slaves currently registered with
+        the master. Only slaves started with the
+        <option>--report-host=<replaceable>slave_name</replaceable></option>
+        option are visible in this list.
+      </para>
+
+      <para>
+        The list is displayed on any server (not just the master
+        server). The output looks like this:
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW SLAVE HOSTS</userinput>;
++------------+-----------+------+-----------+
+| Server_id  | Host      | Port | Master_id |
++------------+-----------+------+-----------+
+|  192168010 | iconnect2 | 3306 | 192168011 |
+| 1921680101 | athena    | 3306 | 192168011 |
++------------+-----------+------+-----------+
+</programlisting>
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
+            <literal>Server_id</literal>: The unique server ID of the
+            slave server, as configured in the server's option file, or
+            on the command line with
+            <option>--server-id=<replaceable>value</replaceable></option>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Host</literal>: The host name of the slave server,
+            as configured in the server's option file, or on the command
+            line with
+            <option>--report-host=<replaceable>value</replaceable></option>.
+            Note that this can differ from the machine name as
+            configured in the operating system.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Port</literal>: The port the slave server is
+            listening on.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_id</literal>: The unique server ID of the
+            master server that the slave server is replicating from.
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+      <para>
+        Some MySQL versions report another variable,
+        <literal>Rpl_recovery_rank</literal>. This variable was never
+        used, and was eventually removed.
+      </para>
+
+      <remark role="help-description-end"/>
+
+    </section>
+
+    <section id="show-slave-status">
+
+      <title><literal>SHOW SLAVE STATUS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW SLAVE STATUS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW SLAVE STATUS"/>
+
+      <remark role="help-keywords">
+        SHOW SLAVE STATUS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW SLAVE STATUS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        This statement provides status information on essential
+        parameters of the slave threads. If you issue this statement
+        using the <command>mysql</command> client, you can use a
+        <literal>\G</literal> statement terminator rather than a
+        semicolon to obtain a more readable vertical layout:
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW SLAVE STATUS\G</userinput>
+*************************** 1. row ***************************
+               Slave_IO_State: Waiting for master to send event
+                  Master_Host: localhost
+                  Master_User: root
+                  Master_Port: 3306
+                Connect_Retry: 3
+              Master_Log_File: gbichot-bin.005
+          Read_Master_Log_Pos: 79
+               Relay_Log_File: gbichot-relay-bin.005
+                Relay_Log_Pos: 548
+        Relay_Master_Log_File: gbichot-bin.005
+             Slave_IO_Running: Yes
+            Slave_SQL_Running: Yes
+              Replicate_Do_DB:
+          Replicate_Ignore_DB:
+                   Last_Errno: 0
+                   Last_Error:
+                 Skip_Counter: 0
+          Exec_Master_Log_Pos: 79
+              Relay_Log_Space: 552
+              Until_Condition: None
+               Until_Log_File:
+                Until_Log_Pos: 0
+           Master_SSL_Allowed: No
+           Master_SSL_CA_File:
+           Master_SSL_CA_Path:
+              Master_SSL_Cert:
+            Master_SSL_Cipher:
+               Master_SSL_Key:
+        Seconds_Behind_Master: 8
+Master_SSL_Verify_Server_Cert: No
+                Last_IO_Errno: 0
+                Last_IO_Error:
+               Last_SQL_Errno: 0
+               Last_SQL_Error:
+</programlisting>
+
+      <remark role="help-description-end"/>
+
+      <para>
+        <literal>SHOW SLAVE STATUS</literal> returns the following
+        fields:
+      </para>
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
+            <literal>Slave_IO_State</literal>
+          </para>
+
+          <remark role="todo">
+            [js] What actually changed in 5.0.12? Need to have this para
+            reviewed...
+          </remark>
+
+          <para>
+            A copy of the <literal>State</literal> field of the output
+            of <literal>SHOW PROCESSLIST</literal> for the slave I/O
+            thread. This tells you what the thread is doing: trying to
+            connect to the master, waiting for events from the master,
+            reconnecting to the master, and so on. Possible states are
+            listed in
+            <xref linkend="replication-implementation-details"/>. It is
+            necessary to check this field for older versions of MySQL
+            which allowed the thread to continue running while
+            unsuccessfully trying to connect to the master. If it is
+            running, there is no problem; if it is not, you can find the
+            error in the <literal>Last_Error</literal> field (described
+            below).
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_Host</literal>
+          </para>
+
+          <para>
+            The current master host.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_User</literal>
+          </para>
+
+          <para>
+            The current user used to connect to the master.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_Port</literal>
+          </para>
+
+          <para>
+            The current master port.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Connect_Retry</literal>
+          </para>
+
+          <para>
+            The number of seconds between connect retries (default 60).
+            This may be set with the <literal>CHANGE MASTER TO</literal>
+            statement or <option>--master-connect-retry</option> option.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_Log_File</literal>
+          </para>
+
+          <para>
+            The name of the master binary log file from which the I/O
+            thread is currently reading.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Read_Master_Log_Pos</literal>
+          </para>
+
+          <para>
+            The position up to which the I/O thread has read in the
+            current master binary log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Log_File</literal>
+          </para>
+
+          <para>
+            The name of the relay log file from which the SQL thread is
+            currently reading and executing.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Log_Pos</literal>
+          </para>
+
+          <para>
+            The position up to which the SQL thread has read and
+            executed in the current relay log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Master_Log_File</literal>
+          </para>
+
+          <para>
+            The name of the master binary log file containing the most
+            recent event executed by the SQL thread.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Slave_IO_Running</literal>
+          </para>
+
+          <para>
+            Whether the I/O thread is started and has connected
+            successfully to the master. For older versions of MySQL
+            (prior to 4.1.14 and 5.0.12)
+            <literal>Slave_IO_Running</literal> is
+            <literal>YES</literal> if the I/O thread is started, even if
+            the slave hasn't connected to the master yet.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Slave_SQL_Running</literal>
+          </para>
+
+          <para>
+            Whether the SQL thread is started.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Replicate_Do_DB</literal>,
+            <literal>Replicate_Ignore_DB</literal>
+          </para>
+
+          <para>
+            The lists of databases that were specified with the
+            <option>--replicate-do-db</option> and
+            <option>--replicate-ignore-db</option> options, if any.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Replicate_Do_Table</literal>,
+            <literal>Replicate_Ignore_Table</literal>,
+            <literal>Replicate_Wild_Do_Table</literal>,
+            <literal>Replicate_Wild_Ignore_Table</literal>
+          </para>
+
+          <para>
+            The lists of tables that were specified with the
+            <option>--replicate-do-table</option>,
+            <option>--replicate-ignore-table</option>,
+            <option>--replicate-wild-do-table</option>, and
+            <option>--replicate-wild-ignore_table</option> options, if
+            any.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Last_Errno</literal>, <literal>Last_Error</literal>
+          </para>
+
+          <para>
+            As of MySQL 5.1.20, these columns are aliases for
+            <literal>Last_SQL_Errno</literal> and
+            <literal>Last_SQL_Error</literal>. Before 5.1.20, they
+            indicate the error number and error message returned by the
+            most recently executed statement. An error number of 0 and
+            message of the empty string mean <quote>no error.</quote> If
+            the <literal>Last_Error</literal> value is not empty, it
+            also appears as a message in the slave's error log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Skip_Counter</literal>
+          </para>
+
+          <para>
+            The most recently used value for
+            <literal>SQL_SLAVE_SKIP_COUNTER</literal>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Exec_Master_Log_Pos</literal>
+          </para>
+
+          <para>
+            The position of the last event executed by the SQL thread
+            from the master's binary log
+            (<literal>Relay_Master_Log_File</literal>).
+            (<literal>Relay_Master_Log_File</literal>,
+            <literal>Exec_Master_Log_Pos</literal>) in the master's
+            binary log corresponds to
+            (<literal>Relay_Log_File</literal>,
+            <literal>Relay_Log_Pos</literal>) in the relay log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Log_Space</literal>
+          </para>
+
+          <para>
+            The total combined size of all existing relay logs.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Until_Condition</literal>,
+            <literal>Until_Log_File</literal>,
+            <literal>Until_Log_Pos</literal>
+          </para>
+
+          <para>
+            The values specified in the <literal>UNTIL</literal> clause
+            of the <literal>START SLAVE</literal> statement.
+          </para>
+
+          <para>
+            <literal>Until_Condition</literal> has these values:
+          </para>
+
+          <itemizedlist>
+
+            <listitem>
+              <para>
+                <literal>None</literal> if no <literal>UNTIL</literal>
+                clause was specified
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>Master</literal> if the slave is reading until
+                a given position in the master's binary logs
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>Relay</literal> if the slave is reading until a
+                given position in its relay logs
+              </para>
+            </listitem>
+
+          </itemizedlist>
+
+          <para>
+            <literal>Until_Log_File</literal> and
+            <literal>Until_Log_Pos</literal> indicate the log filename
+            and position values that define the point at which the SQL
+            thread stops executing.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_SSL_Allowed</literal>,
+            <literal>Master_SSL_CA_File</literal>,
+            <literal>Master_SSL_CA_Path</literal>,
+            <literal>Master_SSL_Cert</literal>,
+            <literal>Master_SSL_Cipher</literal>,
+            <literal>Master_SSL_Key</literal>
+          </para>
+
+          <para>
+            These fields show the SSL parameters used by the slave to
+            connect to the master, if any.
+          </para>
+
+          <para>
+            <literal>Master_SSL_Allowed</literal> has these values:
+          </para>
+
+          <itemizedlist>
+
+            <listitem>
+              <para>
+                <literal>Yes</literal> if an SSL connection to the
+                master is permitted
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>No</literal> if an SSL connection to the master
+                is not permitted
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>Ignored</literal> if an SSL connection is
+                permitted but the slave server does not have SSL support
+                enabled
+              </para>
+            </listitem>
+
+          </itemizedlist>
+
+          <para>
+            The values of the other SSL-related fields correspond to the
+            values of the <literal>MASTER_SSL_CA</literal>,
+            <literal>MASTER_SSL_CAPATH</literal>,
+            <literal>MASTER_SSL_CERT</literal>,
+            <literal>MASTER_SSL_CIPHER</literal>,
+            <literal>MASTER_SSL_KEY</literal>, and
+            <literal>MASTER_SSL_VERIFY_SERVER_CERT</literal> options to
+            the <literal>CHANGE MASTER</literal> statement. See
+            <xref linkend="change-master-to"/>.
+            <literal>MASTER_SSL_VERIFY_SERVER_CERT</literal> was added
+            in MySQL 5.1.18.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Seconds_Behind_Master</literal>
+          </para>
+
+          <para>
+            This field is an indication of how <quote>late</quote> the
+            slave is:
+          </para>
+
+          <itemizedlist>
+
+            <listitem>
+              <para>
+                When the slave SQL thread is actively running
+                (processing updates), this field is the number of
+                seconds that have elapsed since the timestamp of the
+                most recent event on the master executed by that thread.
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                When the SQL thread has caught up to the slave I/O
+                thread and goes idle waiting for more events from the
+                I/O thread, this field is zero.
+              </para>
+            </listitem>
+
+          </itemizedlist>
+
+          <para>
+            In essence, this field measures the time difference in
+            seconds between the slave SQL thread and the slave I/O
+            thread.
+          </para>
+
+          <remark role="todo">
+            How fast is &quot;fast&quot;?
+          </remark>
+
+          <para>
+            If the network connection between master and slave is fast,
+            the slave I/O thread is very close to the master, so this
+            field is a good approximation of how late the slave SQL
+            thread is compared to the master. If the network is slow,
+            this is <emphasis>not</emphasis> a good approximation; the
+            slave SQL thread may quite often be caught up with the
+            slow-reading slave I/O thread, so
+            <literal>Seconds_Behind_Master</literal> often shows a value
+            of 0, even if the I/O thread is late compared to the master.
+            In other words, <emphasis>this column is useful only for
+            fast networks</emphasis>.
+          </para>
+
+          <para>
+            This time difference computation works even though the
+            master and slave do not have identical clocks (the clock
+            difference is computed when the slave I/O thread starts, and
+            assumed to remain constant from then on).
+            <literal>Seconds_Behind_Master</literal> is
+            <literal>NULL</literal> (which means <quote>unknown</quote>)
+            if the slave SQL thread is not running, or if the slave I/O
+            thread is not running or not connected to master. For
+            example if the slave I/O thread is sleeping for the number
+            of seconds given by the <literal>CHANGE MASTER TO</literal>
+            statement or <option>--master-connect-retry</option> option
+            (default 60) before reconnecting, <literal>NULL</literal> is
+            shown, as the slave cannot know what the master is doing,
+            and so cannot say reliably how late it is.
+          </para>
+
+          <para>
+            This field has one limitation. The timestamp is preserved
+            through replication, which means that, if a master M1 is
+            itself a slave of M0, any event from M1's binlog which
+            originates in replicating an event from M0's binlog has the
+            timestamp of that event. This enables MySQL to replicate
+            <literal>TIMESTAMP</literal> successfully. However, the
+            drawback for <literal>Seconds_Behind_Master</literal> is
+            that if M1 also receives direct updates from clients, the
+            value randomly deviates, because sometimes the last M1's
+            event is from M0 and sometimes it is the most recent
+            timestamp from a direct update.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Last_IO_Errno</literal>,
+            <literal>Last_IO_Error</literal>
+          </para>
+
+          <para>
+            The error number and error message of the last error that
+            caused the I/O thread to stop. An error number of 0 and
+            message of the empty string mean <quote>no error.</quote> If
+            the <literal>Last_IO_Error</literal> value is not empty, it
+            also appears as a message in the slave's error log. These
+            columns were added in MySQL 5.1.20.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Last_SQL_Errno</literal>,
+            <literal>Last_SQL_Error</literal>
+          </para>
+
+          <para>
+            The error number and error message of the last error that
+            caused the SQL thread to stop. An error number of 0 and
+            message of the empty string mean <quote>no error.</quote> If
+            the <literal>Last_IO_Error</literal> value is not empty, it
+            also appears as a message in the slave's error log. These
+            columns were added in MySQL 5.1.20.
+          </para>
+
+          <para>
+            Example:
+          </para>
+
+<programlisting>
+Last_SQL_Errno: 1051
+Last_SQL_Error: error 'Unknown table 'z'' on query 'drop table z'
+</programlisting>
+
+          <para>
+            The message indicates that the table <literal>z</literal>
+            existed on the master and was dropped there, but it did not
+            exist on the slave, so <literal>DROP TABLE</literal> failed
+            on the slave. (This might occur, for example, if you forget
+            to copy the table to the slave when setting up replication.)
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+    </section>
+
     <section id="show-status">
 
       <title><literal>SHOW STATUS</literal> Syntax</title>


Modified: trunk/refman-6.0/Makefile.depends
===================================================================
--- trunk/refman-6.0/Makefile.depends	2008-07-24 05:09:52 UTC (rev 11340)
+++ trunk/refman-6.0/Makefile.depends	2008-07-24 07:39:10 UTC (rev 11341)
Changed blocks: 2, Lines Added: 4, Lines Deleted: 4; 1480 bytes

@@ -2519,11 +2519,9 @@
 sql_syntax_replication_IDMAPS = \
 	../refman-6.0/metadata/dba-core.idmap \
 	../refman-6.0/metadata/functions-core.idmap \
-	../refman-6.0/metadata/programs-admin-util-core.idmap \
 	../refman-6.0/metadata/replication-configuration.idmap \
-	../refman-6.0/metadata/replication-implementation.idmap \
-	../refman-6.0/metadata/sql-syntax-data-manipulation.idmap \
-	../refman-6.0/metadata/sql-syntax-replication.idmap
+	../refman-6.0/metadata/sql-syntax-replication.idmap \
+	../refman-6.0/metadata/sql-syntax-server-administration.idmap
 sql-syntax-replication.validpure: $(sql_syntax_replication_SOURCES)
 sql-syntax-replication.titles: $(sql_syntax_replication_SOURCES)
 sql-syntax-replication.useless: $(sql_syntax_replication_SOURCES)

@@ -2555,7 +2553,9 @@
 	../refman-6.0/metadata/language-structure-core.idmap \
 	../refman-6.0/metadata/optimization.idmap \
 	../refman-6.0/metadata/partitioning.idmap \
+	../refman-6.0/metadata/programs-admin-util-core.idmap \
 	../refman-6.0/metadata/programs-installation.idmap \
+	../refman-6.0/metadata/replication-implementation.idmap \
 	../refman-6.0/metadata/replication-notes.idmap \
 	../refman-6.0/metadata/restrictions.idmap \
 	../refman-6.0/metadata/se-archive.idmap \


Modified: trunk/refman-6.0/sql-syntax-replication.xml
===================================================================
--- trunk/refman-6.0/sql-syntax-replication.xml	2008-07-24 05:09:52 UTC (rev 11340)
+++ trunk/refman-6.0/sql-syntax-replication.xml	2008-07-24 07:39:10 UTC (rev 11341)
Changed blocks: 4, Lines Added: 42, Lines Deleted: 804; 26644 bytes

@@ -39,6 +39,42 @@
       statements for managing slave servers.
     </para>
 
+    <para>
+      The following <literal>SHOW</literal> statements are used with
+      master servers in replication:
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
+            <literal>SHOW BINARY LOGS</literal>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>SHOW BINLOG EVENTS</literal>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>SHOW MASTER STATUS</literal>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>SHOW SLAVE HOSTS</literal>
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+      For information about these statements, see
+      <xref linkend="show"/>.
+    </para>
+
     <section id="purge-master-logs">
 
       <title><literal>PURGE MASTER LOGS</literal> Syntax</title>

@@ -240,257 +276,6 @@
 
     </section>
 
-    <section id="show-binlog-events">
-
-      <title><literal>SHOW BINLOG EVENTS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW BINLOG EVENTS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW BINLOG EVENTS"/>
-
-      <remark role="help-keywords">
-        SHOW BINLOG EVENTS LIMIT FROM IN
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW BINLOG EVENTS
-   [IN '<replaceable>log_name</replaceable>'] [FROM <replaceable>pos</replaceable>] [LIMIT [<replaceable>offset</replaceable>,] <replaceable>row_count</replaceable>]
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Shows the events in the binary log. If you do not specify
-        <literal>'<replaceable>log_name</replaceable>'</literal>, the
-        first binary log is displayed.
-      </para>
-
-      <remark role="help-description-end"/>
-
-      <para>
-        The <literal>LIMIT</literal> clause has the same syntax as for
-        the <literal>SELECT</literal> statement. See
-        <xref linkend="select"/>.
-      </para>
-
-      <note>
-        <para>
-          Issuing a <literal>SHOW BINLOG EVENTS</literal> with no
-          <literal>LIMIT</literal> clause could start a very time- and
-          resource-consuming process because the server returns to the
-          client the complete contents of the binary log (which includes
-          all statements executed by the server that modify data). As an
-          alternative to <literal>SHOW BINLOG EVENTS</literal>, use the
-          <command>mysqlbinlog</command> utility to save the binary log
-          to a text file for later examination and analysis. See
-          <xref linkend="mysqlbinlog"/>.
-        </para>
-      </note>
-
-      <note>
-        <para>
-          Events relating to the setting of variables are not included
-          in the output from <literal>SHOW BINLOG EVENTS</literal>. To
-          get complete coverage of events within a binary log, use
-          <link linkend="mysqlbinlog"><literal>mysqlbinlog</literal></link>.
-        </para>
-      </note>
-
-    </section>
-
-    <section id="show-binary-logs">
-
-      <title><literal>SHOW BINARY LOGS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW BINARY LOGS</primary>
-      </indexterm>
-
-      <indexterm>
-        <primary>SHOW MASTER LOGS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW BINARY LOGS"/>
-
-      <remark role="help-keywords">
-        SHOW BINARY MASTER LOGS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW BINARY LOGS
-SHOW MASTER LOGS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Lists the binary log files on the server. This statement is used
-        as part of the procedure described in
-        <xref linkend="purge-master-logs"/>, that shows how to determine
-        which logs can be purged.
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW BINARY LOGS;</userinput>
-+---------------+-----------+
-| Log_name      | File_size |
-+---------------+-----------+
-| binlog.000015 |    724935 |
-| binlog.000016 |    733481 |
-+---------------+-----------+
-</programlisting>
-
-      <remark role="help-description-end"/>
-
-      <para>
-        <literal>SHOW MASTER LOGS</literal> is equivalent to
-        <literal>SHOW BINARY LOGS</literal>.
-      </para>
-
-    </section>
-
-    <section id="show-master-status">
-
-      <title><literal>SHOW MASTER STATUS</literal> Syntax</title>
-
-      <remark role="todo">
-        describe output
-      </remark>
-
-      <indexterm>
-        <primary>SHOW MASTER STATUS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW MASTER STATUS"/>
-
-      <remark role="help-keywords">
-        SHOW MASTER STATUS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW MASTER STATUS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Provides status information about the binary log files of the
-        master. Example:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW MASTER STATUS;</userinput>
-+---------------+----------+--------------+------------------+
-| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB |
-+---------------+----------+--------------+------------------+
-| mysql-bin.003 | 73       | test         | manual,mysql     |
-+---------------+----------+--------------+------------------+
-</programlisting>
-
-      <remark role="help-description-end"/>
-
-    </section>
-
-    <section id="show-slave-hosts">
-
-      <title><literal>SHOW SLAVE HOSTS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW SLAVE HOSTS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW SLAVE HOSTS"/>
-
-      <remark role="help-keywords">
-        SHOW SLAVE HOSTS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW SLAVE HOSTS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        Displays a list of replication slaves currently registered with
-        the master. Only slaves started with the
-        <option>--report-host=<replaceable>slave_name</replaceable></option>
-        option are visible in this list.
-      </para>
-
-      <para>
-        The list is displayed on any server (not just the master
-        server). The output looks like this:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW SLAVE HOSTS</userinput>;
-+------------+-----------+------+-----------+
-| Server_id  | Host      | Port | Master_id |
-+------------+-----------+------+-----------+
-|  192168010 | iconnect2 | 3306 | 192168011 |
-| 1921680101 | athena    | 3306 | 192168011 |
-+------------+-----------+------+-----------+
-</programlisting>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal>Server_id</literal>: The unique server ID of the
-            slave server, as configured in the server's option file, or
-            on the command line with
-            <option>--server-id=<replaceable>value</replaceable></option>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Host</literal>: The host name of the slave server,
-            as configured in the server's option file, or on the command
-            line with
-            <option>--report-host=<replaceable>value</replaceable></option>.
-            Note that this can differ from the machine name as
-            configured in the operating system.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Port</literal>: The port the slave server is
-            listening on.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_id</literal>: The unique server ID of the
-            master server that the slave server is replicating from.
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-      <para>
-        Some MySQL versions report another variable,
-        <literal>Rpl_recovery_rank</literal>. This variable was never
-        used, and was eventually removed.
-      </para>
-
-      <remark role="help-description-end"/>
-
-    </section>
-
   </section>
 
   <section id="replication-slave-sql">

@@ -519,6 +304,12 @@
       statements for managing master servers.
     </para>
 
+    <para>
+      <literal>SHOW SLAVE STATUS</literal> is also used with replication
+      slaves. For information about this statement, see
+      <xref linkend="show-slave-status"/>.
+    </para>
+
     <section id="change-master-to">
 
       <title><literal>CHANGE MASTER TO</literal> Syntax</title>

@@ -930,559 +721,6 @@
 
     </section>
 
-    <section id="show-slave-status">
-
-      <title><literal>SHOW SLAVE STATUS</literal> Syntax</title>
-
-      <indexterm>
-        <primary>SHOW SLAVE STATUS</primary>
-      </indexterm>
-
-      <remark role="help-topic" condition="SHOW SLAVE STATUS"/>
-
-      <remark role="help-keywords">
-        SHOW SLAVE STATUS
-      </remark>
-
-      <remark role="help-syntax"/>
-
-<programlisting>
-SHOW SLAVE STATUS
-</programlisting>
-
-      <remark role="help-description-begin"/>
-
-      <para>
-        This statement provides status information on essential
-        parameters of the slave threads. If you issue this statement
-        using the <command>mysql</command> client, you can use a
-        <literal>\G</literal> statement terminator rather than a
-        semicolon to obtain a more readable vertical layout:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SHOW SLAVE STATUS\G</userinput>
-*************************** 1. row ***************************
-               Slave_IO_State: Waiting for master to send event
-                  Master_Host: localhost
-                  Master_User: root
-                  Master_Port: 3306
-                Connect_Retry: 3
-              Master_Log_File: gbichot-bin.005
-          Read_Master_Log_Pos: 79
-               Relay_Log_File: gbichot-relay-bin.005
-                Relay_Log_Pos: 548
-        Relay_Master_Log_File: gbichot-bin.005
-             Slave_IO_Running: Yes
-            Slave_SQL_Running: Yes
-              Replicate_Do_DB:
-          Replicate_Ignore_DB:
-                   Last_Errno: 0
-                   Last_Error:
-                 Skip_Counter: 0
-          Exec_Master_Log_Pos: 79
-              Relay_Log_Space: 552
-              Until_Condition: None
-               Until_Log_File:
-                Until_Log_Pos: 0
-           Master_SSL_Allowed: No
-           Master_SSL_CA_File:
-           Master_SSL_CA_Path:
-              Master_SSL_Cert:
-            Master_SSL_Cipher:
-               Master_SSL_Key:
-        Seconds_Behind_Master: 8
-Master_SSL_Verify_Server_Cert: No
-                Last_IO_Errno: 0
-                Last_IO_Error:
-               Last_SQL_Errno: 0
-               Last_SQL_Error:
-</programlisting>
-
-      <remark role="help-description-end"/>
-
-      <para>
-        <literal>SHOW SLAVE STATUS</literal> returns the following
-        fields:
-      </para>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal>Slave_IO_State</literal>
-          </para>
-
-          <remark role="todo">
-            [js] What actually changed in 5.0.12? Need to have this para
-            reviewed...
-          </remark>
-
-          <para>
-            A copy of the <literal>State</literal> field of the output
-            of <literal>SHOW PROCESSLIST</literal> for the slave I/O
-            thread. This tells you what the thread is doing: trying to
-            connect to the master, waiting for events from the master,
-            reconnecting to the master, and so on. Possible states are
-            listed in
-            <xref linkend="replication-implementation-details"/>. It is
-            necessary to check this field for older versions of MySQL
-            which allowed the thread to continue running while
-            unsuccessfully trying to connect to the master. If it is
-            running, there is no problem; if it is not, you can find the
-            error in the <literal>Last_Error</literal> field (described
-            below).
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_Host</literal>
-          </para>
-
-          <para>
-            The current master host.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_User</literal>
-          </para>
-
-          <para>
-            The current user used to connect to the master.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_Port</literal>
-          </para>
-
-          <para>
-            The current master port.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Connect_Retry</literal>
-          </para>
-
-          <para>
-            The number of seconds between connect retries (default 60).
-            This may be set with the <literal>CHANGE MASTER TO</literal>
-            statement.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_Log_File</literal>
-          </para>
-
-          <para>
-            The name of the master binary log file from which the I/O
-            thread is currently reading.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Read_Master_Log_Pos</literal>
-          </para>
-
-          <para>
-            The position up to which the I/O thread has read in the
-            current master binary log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Log_File</literal>
-          </para>
-
-          <para>
-            The name of the relay log file from which the SQL thread is
-            currently reading and executing.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Log_Pos</literal>
-          </para>
-
-          <para>
-            The position up to which the SQL thread has read and
-            executed in the current relay log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Master_Log_File</literal>
-          </para>
-
-          <para>
-            The name of the master binary log file containing the most
-            recent event executed by the SQL thread.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Slave_IO_Running</literal>
-          </para>
-
-          <para>
-            Whether the I/O thread is started and has connected
-            successfully to the master. For older versions of MySQL
-            (prior to 4.1.14 and 5.0.12)
-            <literal>Slave_IO_Running</literal> is
-            <literal>YES</literal> if the I/O thread is started, even if
-            the slave hasn't connected to the master yet.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Slave_SQL_Running</literal>
-          </para>
-
-          <para>
-            Whether the SQL thread is started.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Replicate_Do_DB</literal>,
-            <literal>Replicate_Ignore_DB</literal>
-          </para>
-
-          <para>
-            The lists of databases that were specified with the
-            <option>--replicate-do-db</option> and
-            <option>--replicate-ignore-db</option> options, if any.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Replicate_Do_Table</literal>,
-            <literal>Replicate_Ignore_Table</literal>,
-            <literal>Replicate_Wild_Do_Table</literal>,
-            <literal>Replicate_Wild_Ignore_Table</literal>
-          </para>
-
-          <para>
-            The lists of tables that were specified with the
-            <option>--replicate-do-table</option>,
-            <option>--replicate-ignore-table</option>,
-            <option>--replicate-wild-do-table</option>, and
-            <option>--replicate-wild-ignore_table</option> options, if
-            any.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Last_Errno</literal>, <literal>Last_Error</literal>
-          </para>
-
-          <para>
-            These columns are aliases for
-            <literal>Last_SQL_Errno</literal> and
-            <literal>Last_SQL_Error</literal>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Skip_Counter</literal>
-          </para>
-
-          <para>
-            The most recently used value for
-            <literal>SQL_SLAVE_SKIP_COUNTER</literal>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Exec_Master_Log_Pos</literal>
-          </para>
-
-          <para>
-            The position of the last event executed by the SQL thread
-            from the master's binary log
-            (<literal>Relay_Master_Log_File</literal>).
-            (<literal>Relay_Master_Log_File</literal>,
-            <literal>Exec_Master_Log_Pos</literal>) in the master's
-            binary log corresponds to
-            (<literal>Relay_Log_File</literal>,
-            <literal>Relay_Log_Pos</literal>) in the relay log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Relay_Log_Space</literal>
-          </para>
-
-          <para>
-            The total combined size of all existing relay logs.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Until_Condition</literal>,
-            <literal>Until_Log_File</literal>,
-            <literal>Until_Log_Pos</literal>
-          </para>
-
-          <para>
-            The values specified in the <literal>UNTIL</literal> clause
-            of the <literal>START SLAVE</literal> statement.
-          </para>
-
-          <para>
-            <literal>Until_Condition</literal> has these values:
-          </para>
-
-          <itemizedlist>
-
-            <listitem>
-              <para>
-                <literal>None</literal> if no <literal>UNTIL</literal>
-                clause was specified
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>Master</literal> if the slave is reading until
-                a given position in the master's binary logs
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>Relay</literal> if the slave is reading until a
-                given position in its relay logs
-              </para>
-            </listitem>
-
-          </itemizedlist>
-
-          <para>
-            <literal>Until_Log_File</literal> and
-            <literal>Until_Log_Pos</literal> indicate the log filename
-            and position values that define the point at which the SQL
-            thread stops executing.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Master_SSL_Allowed</literal>,
-            <literal>Master_SSL_CA_File</literal>,
-            <literal>Master_SSL_CA_Path</literal>,
-            <literal>Master_SSL_Cert</literal>,
-            <literal>Master_SSL_Cipher</literal>,
-            <literal>Master_SSL_Key</literal>
-          </para>
-
-          <para>
-            These fields show the SSL parameters used by the slave to
-            connect to the master, if any.
-          </para>
-
-          <para>
-            <literal>Master_SSL_Allowed</literal> has these values:
-          </para>
-
-          <itemizedlist>
-
-            <listitem>
-              <para>
-                <literal>Yes</literal> if an SSL connection to the
-                master is permitted
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>No</literal> if an SSL connection to the master
-                is not permitted
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                <literal>Ignored</literal> if an SSL connection is
-                permitted but the slave server does not have SSL support
-                enabled
-              </para>
-            </listitem>
-
-          </itemizedlist>
-
-          <para>
-            The values of the other SSL-related fields correspond to the
-            values of the <literal>MASTER_SSL_CA</literal>,
-            <literal>MASTER_SSL_CAPATH</literal>,
-            <literal>MASTER_SSL_CERT</literal>,
-            <literal>MASTER_SSL_CIPHER</literal>,
-            <literal>MASTER_SSL_KEY</literal>, and
-            <literal>MASTER_SSL_VERIFY_SERVER_CERT</literal> options to
-            the <literal>CHANGE MASTER</literal> statement. See
-            <xref linkend="change-master-to"/>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Seconds_Behind_Master</literal>
-          </para>
-
-          <para>
-            This field is an indication of how <quote>late</quote> the
-            slave is:
-          </para>
-
-          <itemizedlist>
-
-            <listitem>
-              <para>
-                When the slave SQL thread is actively running
-                (processing updates), this field is the number of
-                seconds that have elapsed since the timestamp of the
-                most recent event on the master executed by that thread.
-              </para>
-            </listitem>
-
-            <listitem>
-              <para>
-                When the SQL thread has caught up to the slave I/O
-                thread and goes idle waiting for more events from the
-                I/O thread, this field is zero.
-              </para>
-            </listitem>
-
-          </itemizedlist>
-
-          <para>
-            In essence, this field measures the time difference in
-            seconds between the slave SQL thread and the slave I/O
-            thread.
-          </para>
-
-          <remark role="todo">
-            How fast is &quot;fast&quot;?
-          </remark>
-
-          <para>
-            If the network connection between master and slave is fast,
-            the slave I/O thread is very close to the master, so this
-            field is a good approximation of how late the slave SQL
-            thread is compared to the master. If the network is slow,
-            this is <emphasis>not</emphasis> a good approximation; the
-            slave SQL thread may quite often be caught up with the
-            slow-reading slave I/O thread, so
-            <literal>Seconds_Behind_Master</literal> often shows a value
-            of 0, even if the I/O thread is late compared to the master.
-            In other words, <emphasis>this column is useful only for
-            fast networks</emphasis>.
-          </para>
-
-          <para>
-            This time difference computation works even though the
-            master and slave do not have identical clocks (the clock
-            difference is computed when the slave I/O thread starts, and
-            assumed to remain constant from then on).
-            <literal>Seconds_Behind_Master</literal> is
-            <literal>NULL</literal> (which means <quote>unknown</quote>)
-            if the slave SQL thread is not running, or if the slave I/O
-            thread is not running or not connected to master. For
-            example if the slave I/O thread is sleeping for the number
-            of seconds set by the <literal>CHANGE MASTER TO</literal>
-            statement (default 60) before reconnecting,
-            <literal>NULL</literal> is shown, as the slave cannot know
-            what the master is doing, and so cannot say reliably how
-            late it is.
-          </para>
-
-          <para>
-            This field has one limitation. The timestamp is preserved
-            through replication, which means that, if a master M1 is
-            itself a slave of M0, any event from M1's binlog which
-            originates in replicating an event from M0's binlog has the
-            timestamp of that event. This enables MySQL to replicate
-            <literal>TIMESTAMP</literal> successfully. However, the
-            drawback for <literal>Seconds_Behind_Master</literal> is
-            that if M1 also receives direct updates from clients, the
-            value randomly deviates, because sometimes the last M1's
-            event is from M0 and sometimes it is the most recent
-            timestamp from a direct update.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Last_IO_Errno</literal>,
-            <literal>Last_IO_Error</literal>
-          </para>
-
-          <para>
-            The error number and error message of the last error that
-            caused the I/O thread to stop. An error number of 0 and
-            message of the empty string mean <quote>no error.</quote> If
-            the <literal>Last_IO_Error</literal> value is not empty, it
-            also appears as a message in the slave's error log.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            <literal>Last_SQL_Errno</literal>,
-            <literal>Last_SQL_Error</literal>
-          </para>
-
-          <para>
-            The error number and error message of the last error that
-            caused the SQL thread to stop. An error number of 0 and
-            message of the empty string mean <quote>no error.</quote> If
-            the <literal>Last_IO_Error</literal> value is not empty, it
-            also appears as a message in the slave's error log.
-          </para>
-
-          <para>
-            Example:
-          </para>
-
-<programlisting>
-Last_SQL_Errno: 1051
-Last_SQL_Error: error 'Unknown table 'z'' on query 'drop table z'
-</programlisting>
-
-          <para>
-            The message indicates that the table <literal>z</literal>
-            existed on the master and was dropped there, but it did not
-            exist on the slave, so <literal>DROP TABLE</literal> failed
-            on the slave. (This might occur, for example, if you forget
-            to copy the table to the slave when setting up replication.)
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-    </section>
-
     <section id="start-slave">
 
       <title><literal>START SLAVE</literal> Syntax</title>


Modified: trunk/refman-6.0/sql-syntax-server-administration.xml
===================================================================
--- trunk/refman-6.0/sql-syntax-server-administration.xml	2008-07-24 05:09:52 UTC (rev 11340)
+++ trunk/refman-6.0/sql-syntax-server-administration.xml	2008-07-24 07:39:10 UTC (rev 11341)
Changed blocks: 4, Lines Added: 804, Lines Deleted: 14; 26154 bytes

@@ -3912,20 +3912,6 @@
     </indexterm>
 
     <para>
-      The <literal>SHOW</literal> statement also has forms that provide
-      information about replication master and slave servers and are
-      described in <xref linkend="sql-syntax-replication"/>:
-    </para>
-
-<programlisting>
-SHOW BINARY LOGS
-SHOW BINLOG EVENTS
-SHOW MASTER STATUS
-SHOW SLAVE HOSTS
-SHOW SLAVE STATUS
-</programlisting>
-
-    <para>
       If the syntax for a given <literal>SHOW</literal> statement
       includes a <function role="sqlop" condition="like">LIKE
       '<replaceable>pattern</replaceable>'</function> part,

@@ -3992,6 +3978,121 @@
 
     </section>
 
+    <section id="show-binary-logs">
+
+      <title><literal>SHOW BINARY LOGS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW BINARY LOGS</primary>
+      </indexterm>
+
+      <indexterm>
+        <primary>SHOW MASTER LOGS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW BINARY LOGS"/>
+
+      <remark role="help-keywords">
+        SHOW BINARY MASTER LOGS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW BINARY LOGS
+SHOW MASTER LOGS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Lists the binary log files on the server. This statement is used
+        as part of the procedure described in
+        <xref linkend="purge-master-logs"/>, that shows how to determine
+        which logs can be purged.
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW BINARY LOGS;</userinput>
++---------------+-----------+
+| Log_name      | File_size |
++---------------+-----------+
+| binlog.000015 |    724935 |
+| binlog.000016 |    733481 |
++---------------+-----------+
+</programlisting>
+
+      <remark role="help-description-end"/>
+
+      <para>
+        <literal>SHOW MASTER LOGS</literal> is equivalent to
+        <literal>SHOW BINARY LOGS</literal>.
+      </para>
+
+    </section>
+
+    <section id="show-binlog-events">
+
+      <title><literal>SHOW BINLOG EVENTS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW BINLOG EVENTS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW BINLOG EVENTS"/>
+
+      <remark role="help-keywords">
+        SHOW BINLOG EVENTS LIMIT FROM IN
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW BINLOG EVENTS
+   [IN '<replaceable>log_name</replaceable>'] [FROM <replaceable>pos</replaceable>] [LIMIT [<replaceable>offset</replaceable>,] <replaceable>row_count</replaceable>]
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Shows the events in the binary log. If you do not specify
+        <literal>'<replaceable>log_name</replaceable>'</literal>, the
+        first binary log is displayed.
+      </para>
+
+      <remark role="help-description-end"/>
+
+      <para>
+        The <literal>LIMIT</literal> clause has the same syntax as for
+        the <literal>SELECT</literal> statement. See
+        <xref linkend="select"/>.
+      </para>
+
+      <note>
+        <para>
+          Issuing a <literal>SHOW BINLOG EVENTS</literal> with no
+          <literal>LIMIT</literal> clause could start a very time- and
+          resource-consuming process because the server returns to the
+          client the complete contents of the binary log (which includes
+          all statements executed by the server that modify data). As an
+          alternative to <literal>SHOW BINLOG EVENTS</literal>, use the
+          <command>mysqlbinlog</command> utility to save the binary log
+          to a text file for later examination and analysis. See
+          <xref linkend="mysqlbinlog"/>.
+        </para>
+      </note>
+
+      <note>
+        <para>
+          Events relating to the setting of variables are not included
+          in the output from <literal>SHOW BINLOG EVENTS</literal>. To
+          get complete coverage of events within a binary log, use
+          <link linkend="mysqlbinlog"><literal>mysqlbinlog</literal></link>.
+        </para>
+      </note>
+
+    </section>
+
     <section id="show-character-set">
 
       <title><literal>SHOW CHARACTER SET</literal> Syntax</title>

@@ -6022,6 +6123,50 @@
 
     </section>
 
+    <section id="show-master-status">
+
+      <title><literal>SHOW MASTER STATUS</literal> Syntax</title>
+
+      <remark role="todo">
+        describe output
+      </remark>
+
+      <indexterm>
+        <primary>SHOW MASTER STATUS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW MASTER STATUS"/>
+
+      <remark role="help-keywords">
+        SHOW MASTER STATUS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW MASTER STATUS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Provides status information about the binary log files of the
+        master. Example:
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW MASTER STATUS;</userinput>
++---------------+----------+--------------+------------------+
+| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB |
++---------------+----------+--------------+------------------+
+| mysql-bin.003 | 73       | test         | manual,mysql     |
++---------------+----------+--------------+------------------+
+</programlisting>
+
+      <remark role="help-description-end"/>
+
+    </section>
+
     <section id="show-open-tables">
 
       <title><literal>SHOW OPEN TABLES</literal> Syntax</title>

@@ -6992,6 +7137,651 @@
 
     </section>
 
+    <section id="show-slave-hosts">
+
+      <title><literal>SHOW SLAVE HOSTS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW SLAVE HOSTS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW SLAVE HOSTS"/>
+
+      <remark role="help-keywords">
+        SHOW SLAVE HOSTS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW SLAVE HOSTS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        Displays a list of replication slaves currently registered with
+        the master. Only slaves started with the
+        <option>--report-host=<replaceable>slave_name</replaceable></option>
+        option are visible in this list.
+      </para>
+
+      <para>
+        The list is displayed on any server (not just the master
+        server). The output looks like this:
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW SLAVE HOSTS</userinput>;
++------------+-----------+------+-----------+
+| Server_id  | Host      | Port | Master_id |
++------------+-----------+------+-----------+
+|  192168010 | iconnect2 | 3306 | 192168011 |
+| 1921680101 | athena    | 3306 | 192168011 |
++------------+-----------+------+-----------+
+</programlisting>
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
+            <literal>Server_id</literal>: The unique server ID of the
+            slave server, as configured in the server's option file, or
+            on the command line with
+            <option>--server-id=<replaceable>value</replaceable></option>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Host</literal>: The host name of the slave server,
+            as configured in the server's option file, or on the command
+            line with
+            <option>--report-host=<replaceable>value</replaceable></option>.
+            Note that this can differ from the machine name as
+            configured in the operating system.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Port</literal>: The port the slave server is
+            listening on.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_id</literal>: The unique server ID of the
+            master server that the slave server is replicating from.
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+      <para>
+        Some MySQL versions report another variable,
+        <literal>Rpl_recovery_rank</literal>. This variable was never
+        used, and was eventually removed.
+      </para>
+
+      <remark role="help-description-end"/>
+
+    </section>
+
+    <section id="show-slave-status">
+
+      <title><literal>SHOW SLAVE STATUS</literal> Syntax</title>
+
+      <indexterm>
+        <primary>SHOW SLAVE STATUS</primary>
+      </indexterm>
+
+      <remark role="help-topic" condition="SHOW SLAVE STATUS"/>
+
+      <remark role="help-keywords">
+        SHOW SLAVE STATUS
+      </remark>
+
+      <remark role="help-syntax"/>
+
+<programlisting>
+SHOW SLAVE STATUS
+</programlisting>
+
+      <remark role="help-description-begin"/>
+
+      <para>
+        This statement provides status information on essential
+        parameters of the slave threads. If you issue this statement
+        using the <command>mysql</command> client, you can use a
+        <literal>\G</literal> statement terminator rather than a
+        semicolon to obtain a more readable vertical layout:
+      </para>
+
+<programlisting>
+mysql&gt; <userinput>SHOW SLAVE STATUS\G</userinput>
+*************************** 1. row ***************************
+               Slave_IO_State: Waiting for master to send event
+                  Master_Host: localhost
+                  Master_User: root
+                  Master_Port: 3306
+                Connect_Retry: 3
+              Master_Log_File: gbichot-bin.005
+          Read_Master_Log_Pos: 79
+               Relay_Log_File: gbichot-relay-bin.005
+                Relay_Log_Pos: 548
+        Relay_Master_Log_File: gbichot-bin.005
+             Slave_IO_Running: Yes
+            Slave_SQL_Running: Yes
+              Replicate_Do_DB:
+          Replicate_Ignore_DB:
+                   Last_Errno: 0
+                   Last_Error:
+                 Skip_Counter: 0
+          Exec_Master_Log_Pos: 79
+              Relay_Log_Space: 552
+              Until_Condition: None
+               Until_Log_File:
+                Until_Log_Pos: 0
+           Master_SSL_Allowed: No
+           Master_SSL_CA_File:
+           Master_SSL_CA_Path:
+              Master_SSL_Cert:
+            Master_SSL_Cipher:
+               Master_SSL_Key:
+        Seconds_Behind_Master: 8
+Master_SSL_Verify_Server_Cert: No
+                Last_IO_Errno: 0
+                Last_IO_Error:
+               Last_SQL_Errno: 0
+               Last_SQL_Error:
+</programlisting>
+
+      <remark role="help-description-end"/>
+
+      <para>
+        <literal>SHOW SLAVE STATUS</literal> returns the following
+        fields:
+      </para>
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
+            <literal>Slave_IO_State</literal>
+          </para>
+
+          <remark role="todo">
+            [js] What actually changed in 5.0.12? Need to have this para
+            reviewed...
+          </remark>
+
+          <para>
+            A copy of the <literal>State</literal> field of the output
+            of <literal>SHOW PROCESSLIST</literal> for the slave I/O
+            thread. This tells you what the thread is doing: trying to
+            connect to the master, waiting for events from the master,
+            reconnecting to the master, and so on. Possible states are
+            listed in
+            <xref linkend="replication-implementation-details"/>. It is
+            necessary to check this field for older versions of MySQL
+            which allowed the thread to continue running while
+            unsuccessfully trying to connect to the master. If it is
+            running, there is no problem; if it is not, you can find the
+            error in the <literal>Last_Error</literal> field (described
+            below).
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_Host</literal>
+          </para>
+
+          <para>
+            The current master host.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_User</literal>
+          </para>
+
+          <para>
+            The current user used to connect to the master.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_Port</literal>
+          </para>
+
+          <para>
+            The current master port.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Connect_Retry</literal>
+          </para>
+
+          <para>
+            The number of seconds between connect retries (default 60).
+            This may be set with the <literal>CHANGE MASTER TO</literal>
+            statement.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_Log_File</literal>
+          </para>
+
+          <para>
+            The name of the master binary log file from which the I/O
+            thread is currently reading.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Read_Master_Log_Pos</literal>
+          </para>
+
+          <para>
+            The position up to which the I/O thread has read in the
+            current master binary log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Log_File</literal>
+          </para>
+
+          <para>
+            The name of the relay log file from which the SQL thread is
+            currently reading and executing.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Log_Pos</literal>
+          </para>
+
+          <para>
+            The position up to which the SQL thread has read and
+            executed in the current relay log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Master_Log_File</literal>
+          </para>
+
+          <para>
+            The name of the master binary log file containing the most
+            recent event executed by the SQL thread.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Slave_IO_Running</literal>
+          </para>
+
+          <para>
+            Whether the I/O thread is started and has connected
+            successfully to the master. For older versions of MySQL
+            (prior to 4.1.14 and 5.0.12)
+            <literal>Slave_IO_Running</literal> is
+            <literal>YES</literal> if the I/O thread is started, even if
+            the slave hasn't connected to the master yet.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Slave_SQL_Running</literal>
+          </para>
+
+          <para>
+            Whether the SQL thread is started.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Replicate_Do_DB</literal>,
+            <literal>Replicate_Ignore_DB</literal>
+          </para>
+
+          <para>
+            The lists of databases that were specified with the
+            <option>--replicate-do-db</option> and
+            <option>--replicate-ignore-db</option> options, if any.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Replicate_Do_Table</literal>,
+            <literal>Replicate_Ignore_Table</literal>,
+            <literal>Replicate_Wild_Do_Table</literal>,
+            <literal>Replicate_Wild_Ignore_Table</literal>
+          </para>
+
+          <para>
+            The lists of tables that were specified with the
+            <option>--replicate-do-table</option>,
+            <option>--replicate-ignore-table</option>,
+            <option>--replicate-wild-do-table</option>, and
+            <option>--replicate-wild-ignore_table</option> options, if
+            any.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Last_Errno</literal>, <literal>Last_Error</literal>
+          </para>
+
+          <para>
+            These columns are aliases for
+            <literal>Last_SQL_Errno</literal> and
+            <literal>Last_SQL_Error</literal>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Skip_Counter</literal>
+          </para>
+
+          <para>
+            The most recently used value for
+            <literal>SQL_SLAVE_SKIP_COUNTER</literal>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Exec_Master_Log_Pos</literal>
+          </para>
+
+          <para>
+            The position of the last event executed by the SQL thread
+            from the master's binary log
+            (<literal>Relay_Master_Log_File</literal>).
+            (<literal>Relay_Master_Log_File</literal>,
+            <literal>Exec_Master_Log_Pos</literal>) in the master's
+            binary log corresponds to
+            (<literal>Relay_Log_File</literal>,
+            <literal>Relay_Log_Pos</literal>) in the relay log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Relay_Log_Space</literal>
+          </para>
+
+          <para>
+            The total combined size of all existing relay logs.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Until_Condition</literal>,
+            <literal>Until_Log_File</literal>,
+            <literal>Until_Log_Pos</literal>
+          </para>
+
+          <para>
+            The values specified in the <literal>UNTIL</literal> clause
+            of the <literal>START SLAVE</literal> statement.
+          </para>
+
+          <para>
+            <literal>Until_Condition</literal> has these values:
+          </para>
+
+          <itemizedlist>
+
+            <listitem>
+              <para>
+                <literal>None</literal> if no <literal>UNTIL</literal>
+                clause was specified
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>Master</literal> if the slave is reading until
+                a given position in the master's binary logs
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>Relay</literal> if the slave is reading until a
+                given position in its relay logs
+              </para>
+            </listitem>
+
+          </itemizedlist>
+
+          <para>
+            <literal>Until_Log_File</literal> and
+            <literal>Until_Log_Pos</literal> indicate the log filename
+            and position values that define the point at which the SQL
+            thread stops executing.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Master_SSL_Allowed</literal>,
+            <literal>Master_SSL_CA_File</literal>,
+            <literal>Master_SSL_CA_Path</literal>,
+            <literal>Master_SSL_Cert</literal>,
+            <literal>Master_SSL_Cipher</literal>,
+            <literal>Master_SSL_Key</literal>
+          </para>
+
+          <para>
+            These fields show the SSL parameters used by the slave to
+            connect to the master, if any.
+          </para>
+
+          <para>
+            <literal>Master_SSL_Allowed</literal> has these values:
+          </para>
+
+          <itemizedlist>
+
+            <listitem>
+              <para>
+                <literal>Yes</literal> if an SSL connection to the
+                master is permitted
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>No</literal> if an SSL connection to the master
+                is not permitted
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                <literal>Ignored</literal> if an SSL connection is
+                permitted but the slave server does not have SSL support
+                enabled
+              </para>
+            </listitem>
+
+          </itemizedlist>
+
+          <para>
+            The values of the other SSL-related fields correspond to the
+            values of the <literal>MASTER_SSL_CA</literal>,
+            <literal>MASTER_SSL_CAPATH</literal>,
+            <literal>MASTER_SSL_CERT</literal>,
+            <literal>MASTER_SSL_CIPHER</literal>,
+            <literal>MASTER_SSL_KEY</literal>, and
+            <literal>MASTER_SSL_VERIFY_SERVER_CERT</literal> options to
+            the <literal>CHANGE MASTER</literal> statement. See
+            <xref linkend="change-master-to"/>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Seconds_Behind_Master</literal>
+          </para>
+
+          <para>
+            This field is an indication of how <quote>late</quote> the
+            slave is:
+          </para>
+
+          <itemizedlist>
+
+            <listitem>
+              <para>
+                When the slave SQL thread is actively running
+                (processing updates), this field is the number of
+                seconds that have elapsed since the timestamp of the
+                most recent event on the master executed by that thread.
+              </para>
+            </listitem>
+
+            <listitem>
+              <para>
+                When the SQL thread has caught up to the slave I/O
+                thread and goes idle waiting for more events from the
+                I/O thread, this field is zero.
+              </para>
+            </listitem>
+
+          </itemizedlist>
+
+          <para>
+            In essence, this field measures the time difference in
+            seconds between the slave SQL thread and the slave I/O
+            thread.
+          </para>
+
+          <remark role="todo">
+            How fast is &quot;fast&quot;?
+          </remark>
+
+          <para>
+            If the network connection between master and slave is fast,
+            the slave I/O thread is very close to the master, so this
+            field is a good approximation of how late the slave SQL
+            thread is compared to the master. If the network is slow,
+            this is <emphasis>not</emphasis> a good approximation; the
+            slave SQL thread may quite often be caught up with the
+            slow-reading slave I/O thread, so
+            <literal>Seconds_Behind_Master</literal> often shows a value
+            of 0, even if the I/O thread is late compared to the master.
+            In other words, <emphasis>this column is useful only for
+            fast networks</emphasis>.
+          </para>
+
+          <para>
+            This time difference computation works even though the
+            master and slave do not have identical clocks (the clock
+            difference is computed when the slave I/O thread starts, and
+            assumed to remain constant from then on).
+            <literal>Seconds_Behind_Master</literal> is
+            <literal>NULL</literal> (which means <quote>unknown</quote>)
+            if the slave SQL thread is not running, or if the slave I/O
+            thread is not running or not connected to master. For
+            example if the slave I/O thread is sleeping for the number
+            of seconds set by the <literal>CHANGE MASTER TO</literal>
+            statement (default 60) before reconnecting,
+            <literal>NULL</literal> is shown, as the slave cannot know
+            what the master is doing, and so cannot say reliably how
+            late it is.
+          </para>
+
+          <para>
+            This field has one limitation. The timestamp is preserved
+            through replication, which means that, if a master M1 is
+            itself a slave of M0, any event from M1's binlog which
+            originates in replicating an event from M0's binlog has the
+            timestamp of that event. This enables MySQL to replicate
+            <literal>TIMESTAMP</literal> successfully. However, the
+            drawback for <literal>Seconds_Behind_Master</literal> is
+            that if M1 also receives direct updates from clients, the
+            value randomly deviates, because sometimes the last M1's
+            event is from M0 and sometimes it is the most recent
+            timestamp from a direct update.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Last_IO_Errno</literal>,
+            <literal>Last_IO_Error</literal>
+          </para>
+
+          <para>
+            The error number and error message of the last error that
+            caused the I/O thread to stop. An error number of 0 and
+            message of the empty string mean <quote>no error.</quote> If
+            the <literal>Last_IO_Error</literal> value is not empty, it
+            also appears as a message in the slave's error log.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            <literal>Last_SQL_Errno</literal>,
+            <literal>Last_SQL_Error</literal>
+          </para>
+
+          <para>
+            The error number and error message of the last error that
+            caused the SQL thread to stop. An error number of 0 and
+            message of the empty string mean <quote>no error.</quote> If
+            the <literal>Last_IO_Error</literal> value is not empty, it
+            also appears as a message in the slave's error log.
+          </para>
+
+          <para>
+            Example:
+          </para>
+
+<programlisting>
+Last_SQL_Errno: 1051
+Last_SQL_Error: error 'Unknown table 'z'' on query 'drop table z'
+</programlisting>
+
+          <para>
+            The message indicates that the table <literal>z</literal>
+            existed on the master and was dropped there, but it did not
+            exist on the slave, so <literal>DROP TABLE</literal> failed
+            on the slave. (This might occur, for example, if you forget
+            to copy the table to the slave when setting up replication.)
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+    </section>
+
     <section id="show-status">
 
       <title><literal>SHOW STATUS</literal> Syntax</title>


Thread
svn commit - mysqldoc@docsrva: r11341 - in trunk: refman-4.1 refman-5.0 refman-5.1 refman-6.0jon24 Jul