List:Commits« Previous MessageNext Message »
From:paul Date:July 2 2007 5:10pm
Subject:svn commit - mysqldoc@docsrva: r6992 - in trunk: . refman-4.1 refman-5.0 refman-5.1 refman-5.2
View as plain text  
Author: paul
Date: 2007-07-02 19:10:01 +0200 (Mon, 02 Jul 2007)
New Revision: 6992

Log:
 r22370@frost:  paul | 2007-07-02 12:05:52 -0500
 Fill in INSERT DELAYED-related thread states. (Info from Serg)


Modified:
   trunk/refman-4.1/optimization.xml
   trunk/refman-5.0/optimization.xml
   trunk/refman-5.1/optimization.xml
   trunk/refman-5.2/optimization.xml

Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:27013
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:22369
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:18307
   + 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:27013
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:22370
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:18307


Modified: trunk/refman-4.1/optimization.xml
===================================================================
--- trunk/refman-4.1/optimization.xml	2007-07-02 17:09:47 UTC (rev 6991)
+++ trunk/refman-4.1/optimization.xml	2007-07-02 17:10:01 UTC (rev 6992)
Changed blocks: 8, Lines Added: 294, Lines Deleted: 203; 23873 bytes

@@ -9462,22 +9462,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>allocating local table</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>allocating local table</secondary>
-              </indexterm>
-
-              <literal>allocating local table</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Analyzing</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -9657,27 +9641,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>Creating delayed handler</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>Creating delayed handler</secondary>
-              </indexterm>
-
-              <literal>Creating delayed handler</literal>
-            </para>
-
-            <para>
-              The thread is creating a handler for
-              <literal>DELAYED</literal> inserts.
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Creating index</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -9901,38 +9864,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>got handler lock</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>got handler lock</secondary>
-              </indexterm>
-
-              <literal>got handler lock</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
-                <primary>got old table</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>got old table</secondary>
-              </indexterm>
-
-              <literal>got old table</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>init</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -9949,22 +9880,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>insert</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>insert</secondary>
-              </indexterm>
-
-              <literal>insert</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Killed</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -10323,22 +10238,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>reschedule</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>reschedule</secondary>
-              </indexterm>
-
-              <literal>reschedule</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Rolling back</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -10517,22 +10416,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>storing row into queue</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>storing row into queue</secondary>
-              </indexterm>
-
-              <literal>storing row into queue</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>external locking</primary>
               </indexterm>
 

@@ -10588,22 +10471,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>update</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>update</secondary>
-              </indexterm>
-
-              <literal>update</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Updating</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -10670,252 +10537,476 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>upgrading lock</primary>
+                <primary>User lock</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>upgrading lock</secondary>
+                <secondary>User lock</secondary>
               </indexterm>
 
-              <literal>upgrading lock</literal>
+              <literal>User lock</literal>
             </para>
 
             <para>
-              An <literal>INSERT DELAYED</literal> handler is trying to
-              get a lock for the table to insert rows.
+              The thread is going to request or is waiting for an
+              advisory lock requested with a
+              <literal>GET_LOCK()</literal> call.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>User lock</primary>
+                <primary>Waiting for event from ndbcluster</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>User lock</secondary>
+                <secondary>Waiting for event from ndbcluster</secondary>
               </indexterm>
 
-              <literal>User lock</literal>
+              <literal>Waiting for event from ndbcluster</literal>
             </para>
 
             <para>
-              The thread is going to request or is waiting for an
-              advisory lock requested with a
-              <literal>GET_LOCK()</literal> call.
+              The server is acting as an SQL node in a MySQL Cluster,
+              and is connected to a cluster management node.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for delay_list</primary>
+                <primary>Waiting for tables</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for delay_list</secondary>
+                <secondary>Waiting for tables</secondary>
               </indexterm>
 
-              <literal>waiting for delay_list</literal>
+              <indexterm>
+                <primary>Waiting for table</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>Waiting for table</secondary>
+              </indexterm>
+
+              <literal>Waiting for tables</literal>, <literal>Waiting
+              for table</literal>
             </para>
+
+            <para>
+              The thread got a notification that the underlying
+              structure for a table has changed and it needs to reopen
+              the table to get the new structure. However, to reopen the
+              table, it must wait until all other threads have closed
+              the table in question.
+            </para>
+
+            <para>
+              This notification takes place if another thread has used
+              <literal>FLUSH TABLES</literal> or one of the following
+              statements on the table in question: <literal>FLUSH TABLES
+              <replaceable>tbl_name</replaceable></literal>,
+              <literal>ALTER TABLE</literal>, <literal>RENAME
+              TABLE</literal>, <literal>REPAIR TABLE</literal>,
+              <literal>ANALYZE TABLE</literal>, or <literal>OPTIMIZE
+              TABLE</literal>.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting for event from ndbcluster</primary>
+                <primary>Waiting on cond</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for event from ndbcluster</secondary>
+                <secondary>Waiting on cond</secondary>
               </indexterm>
 
-              <literal>Waiting for event from ndbcluster</literal>
+              <literal>Waiting on cond</literal>
             </para>
+          </listitem>
 
+          <listitem>
             <para>
-              The server is acting as an SQL node in a MySQL Cluster,
-              and is connected to a cluster management node.
+              <indexterm>
+                <primary>Writing to net</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>Writing to net</secondary>
+              </indexterm>
+
+              <literal>Writing to net</literal>
             </para>
+
+            <para>
+              The server is writing a packet to the network.
+            </para>
           </listitem>
 
+        </itemizedlist>
+
+      </section>
+
+      <section id="delayed-insert-thread-states">
+
+        <title>Delayed-Insert Thread States</title>
+
+        <indexterm>
+          <primary>thread states</primary>
+          <secondary>delayed inserts</secondary>
+        </indexterm>
+
+        <indexterm>
+          <primary>delayed inserts</primary>
+          <secondary>thread states</secondary>
+        </indexterm>
+
+        <para>
+          These thread states are associated with processing for
+          <literal>DELAYED</literal> inserts (see
+          <xref linkend="insert-delayed"/>). Some states are associated
+          with connection threads that process <literal>INSERT
+          DELAYED</literal> statements from clients. Other states are
+          associated with delayed-insert handler threads that insert the
+          rows. There is a delayed-insert handler thread for each table
+          for which <literal>INSERT DELAYED</literal> statements are
+          issued.
+        </para>
+
+        <para>
+          States associated with a connection thread that processes an
+          <literal>INSERT DELAYED</literal> statement from the client:
+        </para>
+
+        <itemizedlist>
+
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for handler insert</primary>
+                <primary>allocating local table</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for handler insert</secondary>
+                <secondary>allocating local table</secondary>
               </indexterm>
 
-              <literal>waiting for handler insert</literal>
+              <literal>allocating local table</literal>
             </para>
 
             <para>
-              An <literal>INSERT DELAYED</literal> handler has processed
-              all pending inserts and is waiting for new ones.
+              The thread is preparing to feed rows to the delayed-insert
+              handler thread.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for handler lock</primary>
+                <primary>Creating delayed handler</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for handler lock</secondary>
+                <secondary>Creating delayed handler</secondary>
               </indexterm>
 
-              <literal>waiting for handler lock</literal>
+              <literal>Creating delayed handler</literal>
             </para>
+
+            <para>
+              The thread is creating a handler for
+              <literal>DELAYED</literal> inserts.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for handler open</primary>
+                <primary>got handler lock</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for handler open</secondary>
+                <secondary>got handler lock</secondary>
               </indexterm>
 
-              <literal>waiting for handler open</literal>
+              <literal>got handler lock</literal>
             </para>
+
+            <para>
+              This occurs before the <literal>allocating local
+              table</literal> state and afer the <literal>waiting for
+              handler lock</literal> state, when the connection thread
+              gets access to the delayed-insert handler thread.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting for INSERT</primary>
+                <primary>got old table</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for INSERT</secondary>
+                <secondary>got old table</secondary>
               </indexterm>
 
-              <literal>Waiting for INSERT</literal>
+              <literal>got old table</literal>
             </para>
+
+            <para>
+              This occurs after the <literal>waiting for handler
+              open</literal> state. The delayed-insert handler thread
+              has signaled that it has ended its initialization phase,
+              which includes opening the table for delayed inserts.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting for tables</primary>
+                <primary>storing row into queue</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for tables</secondary>
+                <secondary>storing row into queue</secondary>
               </indexterm>
 
+              <literal>storing row into queue</literal>
+            </para>
+
+            <para>
+              The thread is adding a new row to the list of rows that
+              the delayed-insert handler thread must insert.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
               <indexterm>
-                <primary>Waiting for table</primary>
+                <primary>update</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for table</secondary>
+                <secondary>update</secondary>
               </indexterm>
 
-              <literal>Waiting for tables</literal>, <literal>Waiting
-              for table</literal>
+              <literal>update</literal>
             </para>
+          </listitem>
 
+          <listitem>
             <para>
-              The thread got a notification that the underlying
-              structure for a table has changed and it needs to reopen
-              the table to get the new structure. However, to reopen the
-              table, it must wait until all other threads have closed
-              the table in question.
+              <indexterm>
+                <primary>waiting for delay_list</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>waiting for delay_list</secondary>
+              </indexterm>
+
+              <literal>waiting for delay_list</literal>
             </para>
 
             <para>
-              This notification takes place if another thread has used
-              <literal>FLUSH TABLES</literal> or one of the following
-              statements on the table in question: <literal>FLUSH TABLES
-              <replaceable>tbl_name</replaceable></literal>,
-              <literal>ALTER TABLE</literal>, <literal>RENAME
-              TABLE</literal>, <literal>REPAIR TABLE</literal>,
-              <literal>ANALYZE TABLE</literal>, or <literal>OPTIMIZE
-              TABLE</literal>.
+              This occurs during the initialization phase when the
+              thread is trying to find the delayed-insert handler thread
+              for the table, and before attempting to gain access to the
+              list of delayed-insert threads.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting on cond</primary>
+                <primary>waiting for handler insert</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting on cond</secondary>
+                <secondary>waiting for handler insert</secondary>
               </indexterm>
 
-              <literal>Waiting on cond</literal>
+              <literal>waiting for handler insert</literal>
             </para>
+
+            <para>
+              An <literal>INSERT DELAYED</literal> handler has processed
+              all pending inserts and is waiting for new ones.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Writing to net</primary>
+                <primary>waiting for handler lock</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Writing to net</secondary>
+                <secondary>waiting for handler lock</secondary>
               </indexterm>
 
-              <literal>Writing to net</literal>
+              <literal>waiting for handler lock</literal>
             </para>
 
             <para>
-              The server is writing a packet to the network.
+              This occurs before the <literal>allocating local
+              table</literal> state when the connection thread waits for
+              access to the delayed-insert handler thread.
             </para>
           </listitem>
 
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>waiting for handler open</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>waiting for handler open</secondary>
+              </indexterm>
+
+              <literal>waiting for handler open</literal>
+            </para>
+
+            <para>
+              This occurs after the <literal>Creating delayed
+              handler</literal> state and before the <literal>got old
+              table</literal> state. The delayed-insert handler thread
+              has just been started, and the connection thread is
+              waiting for it to initialize.
+            </para>
+          </listitem>
+
         </itemizedlist>
 
-      </section>
+        <para>
+          States associated with a delayed-insert handler thread that
+          inserts the rows:
+        </para>
 
-      <section id="delayed-insert-thread-states">
+        <itemizedlist>
 
-        <title>Delayed-Insert Thread States</title>
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>insert</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
 
-        <indexterm>
-          <primary>thread states</primary>
-          <secondary>delayed inserts</secondary>
-        </indexterm>
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>insert</secondary>
+              </indexterm>
 
-        <indexterm>
-          <primary>delayed inserts</primary>
-          <secondary>thread states</secondary>
-        </indexterm>
+              <literal>insert</literal>
+            </para>
 
+            <para>
+              The state that occurs just before inserting rows into the
+              table.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>reschedule</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>reschedule</secondary>
+              </indexterm>
+
+              <literal>reschedule</literal>
+            </para>
+
+            <para>
+              After inserting a number of rows, the delayed-insert
+              thread sleeps to let other threads do work.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>upgrading lock</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>upgrading lock</secondary>
+              </indexterm>
+
+              <literal>upgrading lock</literal>
+            </para>
+
+            <para>
+              A delayed-insert handler is trying to get a lock for the
+              table to insert rows.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>Waiting for INSERT</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>Waiting for INSERT</secondary>
+              </indexterm>
+
+              <literal>Waiting for INSERT</literal>
+            </para>
+
+            <para>
+              A delayed-insert handler is waiting for a connection
+              thread to add rows to the queue (see <literal>storing row
+              into queue</literal>).
+            </para>
+          </listitem>
+
+        </itemizedlist>
+
       </section>
 
     </section>


Modified: trunk/refman-5.0/optimization.xml
===================================================================
--- trunk/refman-5.0/optimization.xml	2007-07-02 17:09:47 UTC (rev 6991)
+++ trunk/refman-5.0/optimization.xml	2007-07-02 17:10:01 UTC (rev 6992)
Changed blocks: 8, Lines Added: 296, Lines Deleted: 205; 24157 bytes

@@ -11757,22 +11757,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>allocating local table</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>allocating local table</secondary>
-              </indexterm>
-
-              <literal>allocating local table</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Analyzing</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -11952,27 +11936,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>Creating delayed handler</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>Creating delayed handler</secondary>
-              </indexterm>
-
-              <literal>Creating delayed handler</literal>
-            </para>
-
-            <para>
-              The thread is creating a handler for
-              <literal>DELAYED</literal> inserts.
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Creating index</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12196,38 +12159,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>got handler lock</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>got handler lock</secondary>
-              </indexterm>
-
-              <literal>got handler lock</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
-                <primary>got old table</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>got old table</secondary>
-              </indexterm>
-
-              <literal>got old table</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>init</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12244,22 +12175,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>insert</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>insert</secondary>
-              </indexterm>
-
-              <literal>insert</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Killed</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12618,22 +12533,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>reschedule</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>reschedule</secondary>
-              </indexterm>
-
-              <literal>reschedule</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Rolling back</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12812,22 +12711,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>storing row into queue</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>storing row into queue</secondary>
-              </indexterm>
-
-              <literal>storing row into queue</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>external locking</primary>
               </indexterm>
 

@@ -12885,22 +12768,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>update</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>update</secondary>
-              </indexterm>
-
-              <literal>update</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Updating</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12967,254 +12834,478 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>upgrading lock</primary>
+                <primary>User lock</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>upgrading lock</secondary>
+                <secondary>User lock</secondary>
               </indexterm>
 
-              <literal>upgrading lock</literal>
+              <literal>User lock</literal>
             </para>
 
             <para>
-              An <literal>INSERT DELAYED</literal> handler is trying to
-              get a lock for the table to insert rows.
+              The thread is going to request or is waiting for an
+              advisory lock requested with a
+              <literal>GET_LOCK()</literal> call. For <literal>SHOW
+              PROFILE</literal>, this state means the thread is
+              requesting the lock (not waiting for it).
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>User lock</primary>
+                <primary>Waiting for event from ndbcluster</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>User lock</secondary>
+                <secondary>Waiting for event from ndbcluster</secondary>
               </indexterm>
 
-              <literal>User lock</literal>
+              <literal>Waiting for event from ndbcluster</literal>
             </para>
 
             <para>
-              The thread is going to request or is waiting for an
-              advisory lock requested with a
-              <literal>GET_LOCK()</literal> call. For <literal>SHOW
-              PROFILE</literal>, this state means the thread is
-              requesting the lock (not waiting for it).
+              The server is acting as an SQL node in a MySQL Cluster,
+              and is connected to a cluster management node.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for delay_list</primary>
+                <primary>Waiting for tables</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for delay_list</secondary>
+                <secondary>Waiting for tables</secondary>
               </indexterm>
 
-              <literal>waiting for delay_list</literal>
+              <indexterm>
+                <primary>Waiting for table</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>Waiting for table</secondary>
+              </indexterm>
+
+              <literal>Waiting for tables</literal>, <literal>Waiting
+              for table</literal>
             </para>
+
+            <para>
+              The thread got a notification that the underlying
+              structure for a table has changed and it needs to reopen
+              the table to get the new structure. However, to reopen the
+              table, it must wait until all other threads have closed
+              the table in question.
+            </para>
+
+            <para>
+              This notification takes place if another thread has used
+              <literal>FLUSH TABLES</literal> or one of the following
+              statements on the table in question: <literal>FLUSH TABLES
+              <replaceable>tbl_name</replaceable></literal>,
+              <literal>ALTER TABLE</literal>, <literal>RENAME
+              TABLE</literal>, <literal>REPAIR TABLE</literal>,
+              <literal>ANALYZE TABLE</literal>, or <literal>OPTIMIZE
+              TABLE</literal>.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting for event from ndbcluster</primary>
+                <primary>Waiting on cond</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for event from ndbcluster</secondary>
+                <secondary>Waiting on cond</secondary>
               </indexterm>
 
-              <literal>Waiting for event from ndbcluster</literal>
+              <literal>Waiting on cond</literal>
             </para>
+          </listitem>
 
+          <listitem>
             <para>
-              The server is acting as an SQL node in a MySQL Cluster,
-              and is connected to a cluster management node.
+              <indexterm>
+                <primary>Writing to net</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>Writing to net</secondary>
+              </indexterm>
+
+              <literal>Writing to net</literal>
             </para>
+
+            <para>
+              The server is writing a packet to the network.
+            </para>
           </listitem>
 
+        </itemizedlist>
+
+      </section>
+
+      <section id="delayed-insert-thread-states">
+
+        <title>Delayed-Insert Thread States</title>
+
+        <indexterm>
+          <primary>thread states</primary>
+          <secondary>delayed inserts</secondary>
+        </indexterm>
+
+        <indexterm>
+          <primary>delayed inserts</primary>
+          <secondary>thread states</secondary>
+        </indexterm>
+
+        <para>
+          These thread states are associated with processing for
+          <literal>DELAYED</literal> inserts (see
+          <xref linkend="insert-delayed"/>). Some states are associated
+          with connection threads that process <literal>INSERT
+          DELAYED</literal> statements from clients. Other states are
+          associated with delayed-insert handler threads that insert the
+          rows. There is a delayed-insert handler thread for each table
+          for which <literal>INSERT DELAYED</literal> statements are
+          issued.
+        </para>
+
+        <para>
+          States associated with a connection thread that processes an
+          <literal>INSERT DELAYED</literal> statement from the client:
+        </para>
+
+        <itemizedlist>
+
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for handler insert</primary>
+                <primary>allocating local table</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for handler insert</secondary>
+                <secondary>allocating local table</secondary>
               </indexterm>
 
-              <literal>waiting for handler insert</literal>
+              <literal>allocating local table</literal>
             </para>
 
             <para>
-              An <literal>INSERT DELAYED</literal> handler has processed
-              all pending inserts and is waiting for new ones.
+              The thread is preparing to feed rows to the delayed-insert
+              handler thread.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for handler lock</primary>
+                <primary>Creating delayed handler</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for handler lock</secondary>
+                <secondary>Creating delayed handler</secondary>
               </indexterm>
 
-              <literal>waiting for handler lock</literal>
+              <literal>Creating delayed handler</literal>
             </para>
+
+            <para>
+              The thread is creating a handler for
+              <literal>DELAYED</literal> inserts.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for handler open</primary>
+                <primary>got handler lock</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for handler open</secondary>
+                <secondary>got handler lock</secondary>
               </indexterm>
 
-              <literal>waiting for handler open</literal>
+              <literal>got handler lock</literal>
             </para>
+
+            <para>
+              This occurs before the <literal>allocating local
+              table</literal> state and afer the <literal>waiting for
+              handler lock</literal> state, when the connection thread
+              gets access to the delayed-insert handler thread.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting for INSERT</primary>
+                <primary>got old table</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for INSERT</secondary>
+                <secondary>got old table</secondary>
               </indexterm>
 
-              <literal>Waiting for INSERT</literal>
+              <literal>got old table</literal>
             </para>
+
+            <para>
+              This occurs after the <literal>waiting for handler
+              open</literal> state. The delayed-insert handler thread
+              has signaled that it has ended its initialization phase,
+              which includes opening the table for delayed inserts.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting for tables</primary>
+                <primary>storing row into queue</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for tables</secondary>
+                <secondary>storing row into queue</secondary>
               </indexterm>
 
+              <literal>storing row into queue</literal>
+            </para>
+
+            <para>
+              The thread is adding a new row to the list of rows that
+              the delayed-insert handler thread must insert.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
               <indexterm>
-                <primary>Waiting for table</primary>
+                <primary>update</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for table</secondary>
+                <secondary>update</secondary>
               </indexterm>
 
-              <literal>Waiting for tables</literal>, <literal>Waiting
-              for table</literal>
+              <literal>update</literal>
             </para>
+          </listitem>
 
+          <listitem>
             <para>
-              The thread got a notification that the underlying
-              structure for a table has changed and it needs to reopen
-              the table to get the new structure. However, to reopen the
-              table, it must wait until all other threads have closed
-              the table in question.
+              <indexterm>
+                <primary>waiting for delay_list</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>waiting for delay_list</secondary>
+              </indexterm>
+
+              <literal>waiting for delay_list</literal>
             </para>
 
             <para>
-              This notification takes place if another thread has used
-              <literal>FLUSH TABLES</literal> or one of the following
-              statements on the table in question: <literal>FLUSH TABLES
-              <replaceable>tbl_name</replaceable></literal>,
-              <literal>ALTER TABLE</literal>, <literal>RENAME
-              TABLE</literal>, <literal>REPAIR TABLE</literal>,
-              <literal>ANALYZE TABLE</literal>, or <literal>OPTIMIZE
-              TABLE</literal>.
+              This occurs during the initialization phase when the
+              thread is trying to find the delayed-insert handler thread
+              for the table, and before attempting to gain access to the
+              list of delayed-insert threads.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting on cond</primary>
+                <primary>waiting for handler insert</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting on cond</secondary>
+                <secondary>waiting for handler insert</secondary>
               </indexterm>
 
-              <literal>Waiting on cond</literal>
+              <literal>waiting for handler insert</literal>
             </para>
+
+            <para>
+              An <literal>INSERT DELAYED</literal> handler has processed
+              all pending inserts and is waiting for new ones.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Writing to net</primary>
+                <primary>waiting for handler lock</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Writing to net</secondary>
+                <secondary>waiting for handler lock</secondary>
               </indexterm>
 
-              <literal>Writing to net</literal>
+              <literal>waiting for handler lock</literal>
             </para>
 
             <para>
-              The server is writing a packet to the network.
+              This occurs before the <literal>allocating local
+              table</literal> state when the connection thread waits for
+              access to the delayed-insert handler thread.
             </para>
           </listitem>
 
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>waiting for handler open</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>waiting for handler open</secondary>
+              </indexterm>
+
+              <literal>waiting for handler open</literal>
+            </para>
+
+            <para>
+              This occurs after the <literal>Creating delayed
+              handler</literal> state and before the <literal>got old
+              table</literal> state. The delayed-insert handler thread
+              has just been started, and the connection thread is
+              waiting for it to initialize.
+            </para>
+          </listitem>
+
         </itemizedlist>
 
-      </section>
+        <para>
+          States associated with a delayed-insert handler thread that
+          inserts the rows:
+        </para>
 
-      <section id="delayed-insert-thread-states">
+        <itemizedlist>
 
-        <title>Delayed-Insert Thread States</title>
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>insert</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
 
-        <indexterm>
-          <primary>thread states</primary>
-          <secondary>delayed inserts</secondary>
-        </indexterm>
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>insert</secondary>
+              </indexterm>
 
-        <indexterm>
-          <primary>delayed inserts</primary>
-          <secondary>thread states</secondary>
-        </indexterm>
+              <literal>insert</literal>
+            </para>
 
+            <para>
+              The state that occurs just before inserting rows into the
+              table.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>reschedule</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>reschedule</secondary>
+              </indexterm>
+
+              <literal>reschedule</literal>
+            </para>
+
+            <para>
+              After inserting a number of rows, the delayed-insert
+              thread sleeps to let other threads do work.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>upgrading lock</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>upgrading lock</secondary>
+              </indexterm>
+
+              <literal>upgrading lock</literal>
+            </para>
+
+            <para>
+              A delayed-insert handler is trying to get a lock for the
+              table to insert rows.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>Waiting for INSERT</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>Waiting for INSERT</secondary>
+              </indexterm>
+
+              <literal>Waiting for INSERT</literal>
+            </para>
+
+            <para>
+              A delayed-insert handler is waiting for a connection
+              thread to add rows to the queue (see <literal>storing row
+              into queue</literal>).
+            </para>
+          </listitem>
+
+        </itemizedlist>
+
       </section>
 
     </section>


Modified: trunk/refman-5.1/optimization.xml
===================================================================
--- trunk/refman-5.1/optimization.xml	2007-07-02 17:09:47 UTC (rev 6991)
+++ trunk/refman-5.1/optimization.xml	2007-07-02 17:10:01 UTC (rev 6992)
Changed blocks: 8, Lines Added: 294, Lines Deleted: 203; 23917 bytes

@@ -11970,22 +11970,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>allocating local table</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>allocating local table</secondary>
-              </indexterm>
-
-              <literal>allocating local table</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Analyzing</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12165,27 +12149,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>Creating delayed handler</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>Creating delayed handler</secondary>
-              </indexterm>
-
-              <literal>Creating delayed handler</literal>
-            </para>
-
-            <para>
-              The thread is creating a handler for
-              <literal>DELAYED</literal> inserts.
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Creating index</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12409,38 +12372,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>got handler lock</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>got handler lock</secondary>
-              </indexterm>
-
-              <literal>got handler lock</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
-                <primary>got old table</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>got old table</secondary>
-              </indexterm>
-
-              <literal>got old table</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>init</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12457,22 +12388,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>insert</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>insert</secondary>
-              </indexterm>
-
-              <literal>insert</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Killed</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12831,22 +12746,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>reschedule</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>reschedule</secondary>
-              </indexterm>
-
-              <literal>reschedule</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Rolling back</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -13025,22 +12924,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>storing row into queue</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>storing row into queue</secondary>
-              </indexterm>
-
-              <literal>storing row into queue</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>external locking</primary>
               </indexterm>
 

@@ -13096,22 +12979,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>update</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>update</secondary>
-              </indexterm>
-
-              <literal>update</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Updating</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -13178,252 +13045,476 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>upgrading lock</primary>
+                <primary>User lock</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>upgrading lock</secondary>
+                <secondary>User lock</secondary>
               </indexterm>
 
-              <literal>upgrading lock</literal>
+              <literal>User lock</literal>
             </para>
 
             <para>
-              An <literal>INSERT DELAYED</literal> handler is trying to
-              get a lock for the table to insert rows.
+              The thread is going to request or is waiting for an
+              advisory lock requested with a
+              <literal>GET_LOCK()</literal> call.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>User lock</primary>
+                <primary>Waiting for event from ndbcluster</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>User lock</secondary>
+                <secondary>Waiting for event from ndbcluster</secondary>
               </indexterm>
 
-              <literal>User lock</literal>
+              <literal>Waiting for event from ndbcluster</literal>
             </para>
 
             <para>
-              The thread is going to request or is waiting for an
-              advisory lock requested with a
-              <literal>GET_LOCK()</literal> call.
+              The server is acting as an SQL node in a MySQL Cluster,
+              and is connected to a cluster management node.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for delay_list</primary>
+                <primary>Waiting for tables</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for delay_list</secondary>
+                <secondary>Waiting for tables</secondary>
               </indexterm>
 
-              <literal>waiting for delay_list</literal>
+              <indexterm>
+                <primary>Waiting for table</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>Waiting for table</secondary>
+              </indexterm>
+
+              <literal>Waiting for tables</literal>, <literal>Waiting
+              for table</literal>
             </para>
+
+            <para>
+              The thread got a notification that the underlying
+              structure for a table has changed and it needs to reopen
+              the table to get the new structure. However, to reopen the
+              table, it must wait until all other threads have closed
+              the table in question.
+            </para>
+
+            <para>
+              This notification takes place if another thread has used
+              <literal>FLUSH TABLES</literal> or one of the following
+              statements on the table in question: <literal>FLUSH TABLES
+              <replaceable>tbl_name</replaceable></literal>,
+              <literal>ALTER TABLE</literal>, <literal>RENAME
+              TABLE</literal>, <literal>REPAIR TABLE</literal>,
+              <literal>ANALYZE TABLE</literal>, or <literal>OPTIMIZE
+              TABLE</literal>.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting for event from ndbcluster</primary>
+                <primary>Waiting on cond</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for event from ndbcluster</secondary>
+                <secondary>Waiting on cond</secondary>
               </indexterm>
 
-              <literal>Waiting for event from ndbcluster</literal>
+              <literal>Waiting on cond</literal>
             </para>
+          </listitem>
 
+          <listitem>
             <para>
-              The server is acting as an SQL node in a MySQL Cluster,
-              and is connected to a cluster management node.
+              <indexterm>
+                <primary>Writing to net</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>Writing to net</secondary>
+              </indexterm>
+
+              <literal>Writing to net</literal>
             </para>
+
+            <para>
+              The server is writing a packet to the network.
+            </para>
           </listitem>
 
+        </itemizedlist>
+
+      </section>
+
+      <section id="delayed-insert-thread-states">
+
+        <title>Delayed-Insert Thread States</title>
+
+        <indexterm>
+          <primary>thread states</primary>
+          <secondary>delayed inserts</secondary>
+        </indexterm>
+
+        <indexterm>
+          <primary>delayed inserts</primary>
+          <secondary>thread states</secondary>
+        </indexterm>
+
+        <para>
+          These thread states are associated with processing for
+          <literal>DELAYED</literal> inserts (see
+          <xref linkend="insert-delayed"/>). Some states are associated
+          with connection threads that process <literal>INSERT
+          DELAYED</literal> statements from clients. Other states are
+          associated with delayed-insert handler threads that insert the
+          rows. There is a delayed-insert handler thread for each table
+          for which <literal>INSERT DELAYED</literal> statements are
+          issued.
+        </para>
+
+        <para>
+          States associated with a connection thread that processes an
+          <literal>INSERT DELAYED</literal> statement from the client:
+        </para>
+
+        <itemizedlist>
+
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for handler insert</primary>
+                <primary>allocating local table</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for handler insert</secondary>
+                <secondary>allocating local table</secondary>
               </indexterm>
 
-              <literal>waiting for handler insert</literal>
+              <literal>allocating local table</literal>
             </para>
 
             <para>
-              An <literal>INSERT DELAYED</literal> handler has processed
-              all pending inserts and is waiting for new ones.
+              The thread is preparing to feed rows to the delayed-insert
+              handler thread.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for handler lock</primary>
+                <primary>Creating delayed handler</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for handler lock</secondary>
+                <secondary>Creating delayed handler</secondary>
               </indexterm>
 
-              <literal>waiting for handler lock</literal>
+              <literal>Creating delayed handler</literal>
             </para>
+
+            <para>
+              The thread is creating a handler for
+              <literal>DELAYED</literal> inserts.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for handler open</primary>
+                <primary>got handler lock</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for handler open</secondary>
+                <secondary>got handler lock</secondary>
               </indexterm>
 
-              <literal>waiting for handler open</literal>
+              <literal>got handler lock</literal>
             </para>
+
+            <para>
+              This occurs before the <literal>allocating local
+              table</literal> state and afer the <literal>waiting for
+              handler lock</literal> state, when the connection thread
+              gets access to the delayed-insert handler thread.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting for INSERT</primary>
+                <primary>got old table</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for INSERT</secondary>
+                <secondary>got old table</secondary>
               </indexterm>
 
-              <literal>Waiting for INSERT</literal>
+              <literal>got old table</literal>
             </para>
+
+            <para>
+              This occurs after the <literal>waiting for handler
+              open</literal> state. The delayed-insert handler thread
+              has signaled that it has ended its initialization phase,
+              which includes opening the table for delayed inserts.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting for tables</primary>
+                <primary>storing row into queue</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for tables</secondary>
+                <secondary>storing row into queue</secondary>
               </indexterm>
 
+              <literal>storing row into queue</literal>
+            </para>
+
+            <para>
+              The thread is adding a new row to the list of rows that
+              the delayed-insert handler thread must insert.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
               <indexterm>
-                <primary>Waiting for table</primary>
+                <primary>update</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for table</secondary>
+                <secondary>update</secondary>
               </indexterm>
 
-              <literal>Waiting for tables</literal>, <literal>Waiting
-              for table</literal>
+              <literal>update</literal>
             </para>
+          </listitem>
 
+          <listitem>
             <para>
-              The thread got a notification that the underlying
-              structure for a table has changed and it needs to reopen
-              the table to get the new structure. However, to reopen the
-              table, it must wait until all other threads have closed
-              the table in question.
+              <indexterm>
+                <primary>waiting for delay_list</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>waiting for delay_list</secondary>
+              </indexterm>
+
+              <literal>waiting for delay_list</literal>
             </para>
 
             <para>
-              This notification takes place if another thread has used
-              <literal>FLUSH TABLES</literal> or one of the following
-              statements on the table in question: <literal>FLUSH TABLES
-              <replaceable>tbl_name</replaceable></literal>,
-              <literal>ALTER TABLE</literal>, <literal>RENAME
-              TABLE</literal>, <literal>REPAIR TABLE</literal>,
-              <literal>ANALYZE TABLE</literal>, or <literal>OPTIMIZE
-              TABLE</literal>.
+              This occurs during the initialization phase when the
+              thread is trying to find the delayed-insert handler thread
+              for the table, and before attempting to gain access to the
+              list of delayed-insert threads.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting on cond</primary>
+                <primary>waiting for handler insert</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting on cond</secondary>
+                <secondary>waiting for handler insert</secondary>
               </indexterm>
 
-              <literal>Waiting on cond</literal>
+              <literal>waiting for handler insert</literal>
             </para>
+
+            <para>
+              An <literal>INSERT DELAYED</literal> handler has processed
+              all pending inserts and is waiting for new ones.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Writing to net</primary>
+                <primary>waiting for handler lock</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Writing to net</secondary>
+                <secondary>waiting for handler lock</secondary>
               </indexterm>
 
-              <literal>Writing to net</literal>
+              <literal>waiting for handler lock</literal>
             </para>
 
             <para>
-              The server is writing a packet to the network.
+              This occurs before the <literal>allocating local
+              table</literal> state when the connection thread waits for
+              access to the delayed-insert handler thread.
             </para>
           </listitem>
 
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>waiting for handler open</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>waiting for handler open</secondary>
+              </indexterm>
+
+              <literal>waiting for handler open</literal>
+            </para>
+
+            <para>
+              This occurs after the <literal>Creating delayed
+              handler</literal> state and before the <literal>got old
+              table</literal> state. The delayed-insert handler thread
+              has just been started, and the connection thread is
+              waiting for it to initialize.
+            </para>
+          </listitem>
+
         </itemizedlist>
 
-      </section>
+        <para>
+          States associated with a delayed-insert handler thread that
+          inserts the rows:
+        </para>
 
-      <section id="delayed-insert-thread-states">
+        <itemizedlist>
 
-        <title>Delayed-Insert Thread States</title>
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>insert</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
 
-        <indexterm>
-          <primary>thread states</primary>
-          <secondary>delayed inserts</secondary>
-        </indexterm>
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>insert</secondary>
+              </indexterm>
 
-        <indexterm>
-          <primary>delayed inserts</primary>
-          <secondary>thread states</secondary>
-        </indexterm>
+              <literal>insert</literal>
+            </para>
 
+            <para>
+              The state that occurs just before inserting rows into the
+              table.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>reschedule</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>reschedule</secondary>
+              </indexterm>
+
+              <literal>reschedule</literal>
+            </para>
+
+            <para>
+              After inserting a number of rows, the delayed-insert
+              thread sleeps to let other threads do work.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>upgrading lock</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>upgrading lock</secondary>
+              </indexterm>
+
+              <literal>upgrading lock</literal>
+            </para>
+
+            <para>
+              A delayed-insert handler is trying to get a lock for the
+              table to insert rows.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>Waiting for INSERT</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>Waiting for INSERT</secondary>
+              </indexterm>
+
+              <literal>Waiting for INSERT</literal>
+            </para>
+
+            <para>
+              A delayed-insert handler is waiting for a connection
+              thread to add rows to the queue (see <literal>storing row
+              into queue</literal>).
+            </para>
+          </listitem>
+
+        </itemizedlist>
+
       </section>
 
       <section id="event-scheduler-thread-states">


Modified: trunk/refman-5.2/optimization.xml
===================================================================
--- trunk/refman-5.2/optimization.xml	2007-07-02 17:09:47 UTC (rev 6991)
+++ trunk/refman-5.2/optimization.xml	2007-07-02 17:10:01 UTC (rev 6992)
Changed blocks: 8, Lines Added: 294, Lines Deleted: 203; 23917 bytes

@@ -11960,22 +11960,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>allocating local table</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>allocating local table</secondary>
-              </indexterm>
-
-              <literal>allocating local table</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Analyzing</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12155,27 +12139,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>Creating delayed handler</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>Creating delayed handler</secondary>
-              </indexterm>
-
-              <literal>Creating delayed handler</literal>
-            </para>
-
-            <para>
-              The thread is creating a handler for
-              <literal>DELAYED</literal> inserts.
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Creating index</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12399,38 +12362,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>got handler lock</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>got handler lock</secondary>
-              </indexterm>
-
-              <literal>got handler lock</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
-                <primary>got old table</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>got old table</secondary>
-              </indexterm>
-
-              <literal>got old table</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>init</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12447,22 +12378,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>insert</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>insert</secondary>
-              </indexterm>
-
-              <literal>insert</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Killed</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -12821,22 +12736,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>reschedule</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>reschedule</secondary>
-              </indexterm>
-
-              <literal>reschedule</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Rolling back</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -13015,22 +12914,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>storing row into queue</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>storing row into queue</secondary>
-              </indexterm>
-
-              <literal>storing row into queue</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>external locking</primary>
               </indexterm>
 

@@ -13086,22 +12969,6 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>update</primary>
-                <secondary>thread state</secondary>
-              </indexterm>
-
-              <indexterm>
-                <primary>thread state</primary>
-                <secondary>update</secondary>
-              </indexterm>
-
-              <literal>update</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              <indexterm>
                 <primary>Updating</primary>
                 <secondary>thread state</secondary>
               </indexterm>

@@ -13168,252 +13035,476 @@
           <listitem>
             <para>
               <indexterm>
-                <primary>upgrading lock</primary>
+                <primary>User lock</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>upgrading lock</secondary>
+                <secondary>User lock</secondary>
               </indexterm>
 
-              <literal>upgrading lock</literal>
+              <literal>User lock</literal>
             </para>
 
             <para>
-              An <literal>INSERT DELAYED</literal> handler is trying to
-              get a lock for the table to insert rows.
+              The thread is going to request or is waiting for an
+              advisory lock requested with a
+              <literal>GET_LOCK()</literal> call.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>User lock</primary>
+                <primary>Waiting for event from ndbcluster</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>User lock</secondary>
+                <secondary>Waiting for event from ndbcluster</secondary>
               </indexterm>
 
-              <literal>User lock</literal>
+              <literal>Waiting for event from ndbcluster</literal>
             </para>
 
             <para>
-              The thread is going to request or is waiting for an
-              advisory lock requested with a
-              <literal>GET_LOCK()</literal> call.
+              The server is acting as an SQL node in a MySQL Cluster,
+              and is connected to a cluster management node.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for delay_list</primary>
+                <primary>Waiting for tables</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for delay_list</secondary>
+                <secondary>Waiting for tables</secondary>
               </indexterm>
 
-              <literal>waiting for delay_list</literal>
+              <indexterm>
+                <primary>Waiting for table</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>Waiting for table</secondary>
+              </indexterm>
+
+              <literal>Waiting for tables</literal>, <literal>Waiting
+              for table</literal>
             </para>
+
+            <para>
+              The thread got a notification that the underlying
+              structure for a table has changed and it needs to reopen
+              the table to get the new structure. However, to reopen the
+              table, it must wait until all other threads have closed
+              the table in question.
+            </para>
+
+            <para>
+              This notification takes place if another thread has used
+              <literal>FLUSH TABLES</literal> or one of the following
+              statements on the table in question: <literal>FLUSH TABLES
+              <replaceable>tbl_name</replaceable></literal>,
+              <literal>ALTER TABLE</literal>, <literal>RENAME
+              TABLE</literal>, <literal>REPAIR TABLE</literal>,
+              <literal>ANALYZE TABLE</literal>, or <literal>OPTIMIZE
+              TABLE</literal>.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting for event from ndbcluster</primary>
+                <primary>Waiting on cond</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for event from ndbcluster</secondary>
+                <secondary>Waiting on cond</secondary>
               </indexterm>
 
-              <literal>Waiting for event from ndbcluster</literal>
+              <literal>Waiting on cond</literal>
             </para>
+          </listitem>
 
+          <listitem>
             <para>
-              The server is acting as an SQL node in a MySQL Cluster,
-              and is connected to a cluster management node.
+              <indexterm>
+                <primary>Writing to net</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>Writing to net</secondary>
+              </indexterm>
+
+              <literal>Writing to net</literal>
             </para>
+
+            <para>
+              The server is writing a packet to the network.
+            </para>
           </listitem>
 
+        </itemizedlist>
+
+      </section>
+
+      <section id="delayed-insert-thread-states">
+
+        <title>Delayed-Insert Thread States</title>
+
+        <indexterm>
+          <primary>thread states</primary>
+          <secondary>delayed inserts</secondary>
+        </indexterm>
+
+        <indexterm>
+          <primary>delayed inserts</primary>
+          <secondary>thread states</secondary>
+        </indexterm>
+
+        <para>
+          These thread states are associated with processing for
+          <literal>DELAYED</literal> inserts (see
+          <xref linkend="insert-delayed"/>). Some states are associated
+          with connection threads that process <literal>INSERT
+          DELAYED</literal> statements from clients. Other states are
+          associated with delayed-insert handler threads that insert the
+          rows. There is a delayed-insert handler thread for each table
+          for which <literal>INSERT DELAYED</literal> statements are
+          issued.
+        </para>
+
+        <para>
+          States associated with a connection thread that processes an
+          <literal>INSERT DELAYED</literal> statement from the client:
+        </para>
+
+        <itemizedlist>
+
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for handler insert</primary>
+                <primary>allocating local table</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for handler insert</secondary>
+                <secondary>allocating local table</secondary>
               </indexterm>
 
-              <literal>waiting for handler insert</literal>
+              <literal>allocating local table</literal>
             </para>
 
             <para>
-              An <literal>INSERT DELAYED</literal> handler has processed
-              all pending inserts and is waiting for new ones.
+              The thread is preparing to feed rows to the delayed-insert
+              handler thread.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for handler lock</primary>
+                <primary>Creating delayed handler</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for handler lock</secondary>
+                <secondary>Creating delayed handler</secondary>
               </indexterm>
 
-              <literal>waiting for handler lock</literal>
+              <literal>Creating delayed handler</literal>
             </para>
+
+            <para>
+              The thread is creating a handler for
+              <literal>DELAYED</literal> inserts.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>waiting for handler open</primary>
+                <primary>got handler lock</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>waiting for handler open</secondary>
+                <secondary>got handler lock</secondary>
               </indexterm>
 
-              <literal>waiting for handler open</literal>
+              <literal>got handler lock</literal>
             </para>
+
+            <para>
+              This occurs before the <literal>allocating local
+              table</literal> state and afer the <literal>waiting for
+              handler lock</literal> state, when the connection thread
+              gets access to the delayed-insert handler thread.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting for INSERT</primary>
+                <primary>got old table</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for INSERT</secondary>
+                <secondary>got old table</secondary>
               </indexterm>
 
-              <literal>Waiting for INSERT</literal>
+              <literal>got old table</literal>
             </para>
+
+            <para>
+              This occurs after the <literal>waiting for handler
+              open</literal> state. The delayed-insert handler thread
+              has signaled that it has ended its initialization phase,
+              which includes opening the table for delayed inserts.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting for tables</primary>
+                <primary>storing row into queue</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for tables</secondary>
+                <secondary>storing row into queue</secondary>
               </indexterm>
 
+              <literal>storing row into queue</literal>
+            </para>
+
+            <para>
+              The thread is adding a new row to the list of rows that
+              the delayed-insert handler thread must insert.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
               <indexterm>
-                <primary>Waiting for table</primary>
+                <primary>update</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting for table</secondary>
+                <secondary>update</secondary>
               </indexterm>
 
-              <literal>Waiting for tables</literal>, <literal>Waiting
-              for table</literal>
+              <literal>update</literal>
             </para>
+          </listitem>
 
+          <listitem>
             <para>
-              The thread got a notification that the underlying
-              structure for a table has changed and it needs to reopen
-              the table to get the new structure. However, to reopen the
-              table, it must wait until all other threads have closed
-              the table in question.
+              <indexterm>
+                <primary>waiting for delay_list</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>waiting for delay_list</secondary>
+              </indexterm>
+
+              <literal>waiting for delay_list</literal>
             </para>
 
             <para>
-              This notification takes place if another thread has used
-              <literal>FLUSH TABLES</literal> or one of the following
-              statements on the table in question: <literal>FLUSH TABLES
-              <replaceable>tbl_name</replaceable></literal>,
-              <literal>ALTER TABLE</literal>, <literal>RENAME
-              TABLE</literal>, <literal>REPAIR TABLE</literal>,
-              <literal>ANALYZE TABLE</literal>, or <literal>OPTIMIZE
-              TABLE</literal>.
+              This occurs during the initialization phase when the
+              thread is trying to find the delayed-insert handler thread
+              for the table, and before attempting to gain access to the
+              list of delayed-insert threads.
             </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Waiting on cond</primary>
+                <primary>waiting for handler insert</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Waiting on cond</secondary>
+                <secondary>waiting for handler insert</secondary>
               </indexterm>
 
-              <literal>Waiting on cond</literal>
+              <literal>waiting for handler insert</literal>
             </para>
+
+            <para>
+              An <literal>INSERT DELAYED</literal> handler has processed
+              all pending inserts and is waiting for new ones.
+            </para>
           </listitem>
 
           <listitem>
             <para>
               <indexterm>
-                <primary>Writing to net</primary>
+                <primary>waiting for handler lock</primary>
                 <secondary>thread state</secondary>
               </indexterm>
 
               <indexterm>
                 <primary>thread state</primary>
-                <secondary>Writing to net</secondary>
+                <secondary>waiting for handler lock</secondary>
               </indexterm>
 
-              <literal>Writing to net</literal>
+              <literal>waiting for handler lock</literal>
             </para>
 
             <para>
-              The server is writing a packet to the network.
+              This occurs before the <literal>allocating local
+              table</literal> state when the connection thread waits for
+              access to the delayed-insert handler thread.
             </para>
           </listitem>
 
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>waiting for handler open</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>waiting for handler open</secondary>
+              </indexterm>
+
+              <literal>waiting for handler open</literal>
+            </para>
+
+            <para>
+              This occurs after the <literal>Creating delayed
+              handler</literal> state and before the <literal>got old
+              table</literal> state. The delayed-insert handler thread
+              has just been started, and the connection thread is
+              waiting for it to initialize.
+            </para>
+          </listitem>
+
         </itemizedlist>
 
-      </section>
+        <para>
+          States associated with a delayed-insert handler thread that
+          inserts the rows:
+        </para>
 
-      <section id="delayed-insert-thread-states">
+        <itemizedlist>
 
-        <title>Delayed-Insert Thread States</title>
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>insert</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
 
-        <indexterm>
-          <primary>thread states</primary>
-          <secondary>delayed inserts</secondary>
-        </indexterm>
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>insert</secondary>
+              </indexterm>
 
-        <indexterm>
-          <primary>delayed inserts</primary>
-          <secondary>thread states</secondary>
-        </indexterm>
+              <literal>insert</literal>
+            </para>
 
+            <para>
+              The state that occurs just before inserting rows into the
+              table.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>reschedule</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>reschedule</secondary>
+              </indexterm>
+
+              <literal>reschedule</literal>
+            </para>
+
+            <para>
+              After inserting a number of rows, the delayed-insert
+              thread sleeps to let other threads do work.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>upgrading lock</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>upgrading lock</secondary>
+              </indexterm>
+
+              <literal>upgrading lock</literal>
+            </para>
+
+            <para>
+              A delayed-insert handler is trying to get a lock for the
+              table to insert rows.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              <indexterm>
+                <primary>Waiting for INSERT</primary>
+                <secondary>thread state</secondary>
+              </indexterm>
+
+              <indexterm>
+                <primary>thread state</primary>
+                <secondary>Waiting for INSERT</secondary>
+              </indexterm>
+
+              <literal>Waiting for INSERT</literal>
+            </para>
+
+            <para>
+              A delayed-insert handler is waiting for a connection
+              thread to add rows to the queue (see <literal>storing row
+              into queue</literal>).
+            </para>
+          </listitem>
+
+        </itemizedlist>
+
       </section>
 
       <section id="event-scheduler-thread-states">


Thread
svn commit - mysqldoc@docsrva: r6992 - in trunk: . refman-4.1 refman-5.0 refman-5.1 refman-5.2paul2 Jul