Author: jstephens
Date: 2006-10-18 15:40:14 +0200 (Wed, 18 Oct 2006)
New Revision: 3672
Log:
Obtaining status & debugging info about the Event Scheduler
(Thanks, Andrey & Trudy!)
Modified:
trunk/refman-5.1/client-utility-programs.xml
trunk/refman-5.1/events.xml
trunk/refman-5.1/sql-syntax.xml
Modified: trunk/refman-5.1/client-utility-programs.xml
===================================================================
--- trunk/refman-5.1/client-utility-programs.xml 2006-10-18 10:58:36 UTC (rev 3671)
+++ trunk/refman-5.1/client-utility-programs.xml 2006-10-18 13:40:14 UTC (rev 3672)
Changed blocks: 1, Lines Added: 6, Lines Deleted: 0; 681 bytes
@@ -6310,6 +6310,12 @@
Tell the server to write debug information to the error
log.
</para>
+
+ <para>
+ Beginning with MySQL 5.1.12, this includes information
+ about the Event Scheduler. See
+ <xref linkend="events-status-info"/>.
+ </para>
</listitem>
<listitem>
Modified: trunk/refman-5.1/events.xml
===================================================================
--- trunk/refman-5.1/events.xml 2006-10-18 10:58:36 UTC (rev 3671)
+++ trunk/refman-5.1/events.xml 2006-10-18 13:40:14 UTC (rev 3672)
Changed blocks: 14, Lines Added: 193, Lines Deleted: 0; 7967 bytes
@@ -12,6 +12,14 @@
<chapter id="events">
<title>Event Scheduler</title>
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>events</primary>
+ </indexterm>
<remark role="note">
Author: Jon Stephens. Based on WL#1034 and materials supplied by
@@ -94,6 +102,11 @@
<section id="events-overview">
<title>Event Scheduler Overview</title>
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>concepts</secondary>
+ </indexterm>
<para>
MySQL Events are tasks that run according to a schedule.
@@ -213,6 +226,17 @@
<literal>SUPER</literal> privilege in the output of <literal>SHOW
PROCESSLIST</literal>, as shown in the discussion that follows.
</para>
+
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>enabling and disabling</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>starting and stopping</secondary>
+ </indexterm>
<para id="events-event-scheduler-option">
The global variable <literal>event_scheduler</literal> determines
@@ -246,6 +270,11 @@
<literal>ON</literal>: The Event Scheduler is started; the
event scheduler thread runs and executes all scheduled events.
</para>
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>and <literal>SHOW
PROCESSLIST</literal></secondary>
+ </indexterm>
<para>
When the Event Scheduler is <literal>ON</literal>, the event
@@ -483,6 +512,13 @@
<section id="events-syntax">
<title>Event Scheduler Syntax</title>
+
+
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>SQL statements</secondary>
+ </indexterm>
<para>
MySQL 5.1.6 and later provides several SQL statements for working
@@ -532,6 +568,21 @@
<section id="create-event">
<title><literal>CREATE EVENT</literal> Syntax</title>
+
+
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>creating events</secondary>
+ </indexterm>
+ <indexterm>
+ <primary>events</primary>
+ <secondary>creating</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary><literal>CREATE EVENT</literal></primary>
+ </indexterm>
<programlisting>
CREATE EVENT [IF NOT EXISTS] <replaceable>event_name</replaceable>
@@ -988,6 +1039,20 @@
<section id="alter-event">
<title><literal>ALTER EVENT</literal> Syntax</title>
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>altering events</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>events</primary>
+ <secondary>altering</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary><literal>ALTER EVENT</literal></primary>
+ </indexterm>
<programlisting>
ALTER EVENT <replaceable>event_name</replaceable>
@@ -1141,6 +1206,20 @@
<section id="drop-event">
<title><literal>DROP EVENT</literal> Syntax</title>
+
+ <indexterm>
+ <primary><literal>DROP EVENT</literal></primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>dropping events</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>events</primary>
+ <secondary>dropping</secondary>
+ </indexterm>
<programlisting>
DROP EVENT [IF EXISTS] <replaceable>event_name</replaceable>
@@ -1174,8 +1253,20 @@
</section>
<section id="events-metadata">
+
+
<title>Event Metadata</title>
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>event metadata</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>events</primary>
+ <secondary>metadata</secondary>
+ </indexterm>
<para>
Information about events can be obtained as follows:
@@ -1216,10 +1307,93 @@
</itemizedlist>
</section>
+
+ <section id="events-status-info">
+ <title>Event Scheduler Status</title>
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>obtaining status information</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>SHOW SCHEDULER STATUS</primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>and <command>mysqladmin
debug</command></secondary>
+ </indexterm>
+
+ <para>
+ Information about the state of the Event Scheduler for debugging
+ and troubleshooting purposes can be obtained as follows:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ In MySQL 5.1.11 <literal>-debug</literal> builds, you can use
+ the <literal>SHOW SCHEDULER STATUS</literal> statement; see
+ <xref linkend="show-scheduler-status"/>.
+ </para>
+
+ <para>
+ <emphasis role="bold">Important</emphasis>: This statement was
+ removed in MySQL 5.1.12. We intend to implement an SQL
+ statement providing similar functionality in a future MySQL
+ release.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Beginning with MySQL 5.1.12, event scheduler
+ status information can be obtained by running the
+ <command>mysqladmin debug</command> (see
+ <xref linkend="mysqladmin"/>); after running this command, the
+ error log contains output relating to the Event Scheduler,
+ similar to what is shown here:
+ </para>
+
+<programlisting>
+Events status:
+LLA = Last Locked At LUA = Last Unlocked At
+WOC = Waiting On Condition DL = Data Locked
+Event scheduler status:
+State : INITIALIZED
+Thread id : 0
+LLA : init_scheduler:313
+LUA : init_scheduler:318
+WOC : NO
+Workers : 0
+Executed : 0
+Data locked: NO
+
+Event queue status:
+Element count : 1
+Data locked : NO
+Attempting lock : NO
+LLA : init_queue:148
+LUA : init_queue:168
+WOC : NO
+Next activation : 0000-00-00 00:00:00
+</programlisting>
+ </listitem>
+ </itemizedlist>
+
+ </section>
+
+
<section id="events-privileges">
<title>The Event Scheduler and MySQL Privileges</title>
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>and MySQL privileges</secondary>
+ </indexterm>
<para>
To enable or disable the execution of scheduled events, it is
@@ -1326,6 +1500,11 @@
<errortext>ERROR 1142 (42000): INSERT command denied to user
'jon'@'ghidora' for table 'mytable'</errortext>
</programlisting>
+
+ <indexterm>
+ <primary><literal>EVENTS</literal></primary>
+ <secondary><literal>INFORMATION_SCHEMA</literal>
table</secondary>
+ </indexterm>
<para>
Inspection of the <literal>INFORMATION_SCHEMA.EVENTS</literal>
@@ -1411,6 +1590,10 @@
<literal>e_insert</literal> continues to execute, inserting a new
row into <literal>mytable</literal> each seven seconds.
</para>
+
+ <indexterm>
+ <primary><literal>mysql.event</literal> table</primary>
+ </indexterm>
<para>
Event definitions are stored in the <literal>mysql.event</literal>
@@ -1474,6 +1657,11 @@
<remark role="todo">
[js] Move to status variables section.
</remark>
+
+ <indexterm>
+ <primary>events</primary>
+ <secondary>status variables</secondary>
+ </indexterm>
<para>
MySQL 5.1.6 introduces five status variables providing counts of
@@ -1542,6 +1730,11 @@
<section id="events-limitations-restrictions">
<title>Event Scheduler Limitations and Restrictions</title>
+
+ <indexterm>
+ <primary>events</primary>
+ <secondary>limitations</secondary>
+ </indexterm>
<para>
This section lists restrictions and limitations applying to event
Modified: trunk/refman-5.1/sql-syntax.xml
===================================================================
--- trunk/refman-5.1/sql-syntax.xml 2006-10-18 10:58:36 UTC (rev 3671)
+++ trunk/refman-5.1/sql-syntax.xml 2006-10-18 13:40:14 UTC (rev 3672)
Changed blocks: 3, Lines Added: 67, Lines Deleted: 0; 3519 bytes
@@ -16997,6 +16997,10 @@
<indexterm type="function">
<primary>SHOW PROCESSLIST</primary>
</indexterm>
+
+ <indexterm type="function">
+ <primary>SHOW SCHEDULER STATUS</primary>
+ </indexterm>
<indexterm type="function">
<primary>SHOW STATUS</primary>
@@ -17073,6 +17077,7 @@
SHOW PLUGINS
SHOW PRIVILEGES
SHOW [FULL] PROCESSLIST
+SHOW SCHEDULER STATUS
SHOW [GLOBAL | SESSION] STATUS [LIKE '<replaceable>pattern</replaceable>']
SHOW TABLE STATUS [FROM <replaceable>db_name</replaceable>] [LIKE
'<replaceable>pattern</replaceable>']
SHOW [OPEN] TABLES [FROM <replaceable>db_name</replaceable>] [LIKE
'<replaceable>pattern</replaceable>']
@@ -19764,7 +19769,69 @@
</para>
</section>
+
+ <section id="show-scheduler-status">
+ <title><literal>SHOW SCHEDULER STATUS</literal>
Syntax</title>
+
+ <remark role="todo">
+ [js] Add pointer to SHOW EVENT STATUS when that statement is
+ implemented.
+ </remark>
+
+ <indexterm>
+ <primary>Event Scheduler</primary>
+ <secondary>obtaining status information</secondary>
+ </indexterm>
+
+<programlisting>
+SHOW SCHEDULER STATUS
+</programlisting>
+
+ <para>
+ This statement provides debugging information regarding the
+ Event Scheduler's state. It is supported only in
+ <literal>-debug</literal> builds of MySQL 5.1.11, and was
+ removed in 5.1.12 and subsequent releases.
+ </para>
+ <para>
+ Sample output is shown here:
+ </para>
+
+<programlisting>
++--------------------------------+---------------------+
+| Name | Value |
++--------------------------------+---------------------+
+| scheduler state | INITIALIZED |
+| thread_id | NULL |
+| scheduler last locked at | init_scheduler::313 |
+| scheduler last unlocked at | init_scheduler::318 |
+| scheduler waiting on condition | 0 |
+| scheduler workers count | 0 |
+| scheduler executed events | 0 |
+| scheduler data locked | 0 |
+| queue element count | 1 |
+| queue data locked | 0 |
+| queue data attempting lock | 0 |
+| queue last locked at | create_event::218 |
+| queue last unlocked at | create_event::222 |
+| queue last attempted lock at | ::0 |
+| queue waiting on condition | 0 |
+| next activation at | 0-00-00 00:00:00 |
++--------------------------------+---------------------+
+</programlisting>
+
+ <para>
+ In MySQL 5.1.12 and later, this information can be obtained
+ using <command>mysqladmin debug</command>. (See
+ <xref linkend="mysqladmin"/>.) For more information about
+ obtaining Event Scheduler status information, see
+ <xref linkend="events-status-info"/>.
+ </para>
+
+ </section>
+
+
<section id="show-status">
<title><literal>SHOW STATUS</literal> Syntax</title>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r3672 - trunk/refman-5.1 | jon | 18 Oct |