List:Commits« Previous MessageNext Message »
From:Ingo Struewing Date:October 12 2007 10:28am
Subject:bk commit into 5.1 tree (istruewing:1.2571) BUG#31210
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of istruewing. When istruewing does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-10-12 12:28:09+02:00, istruewing@stripped +3 -0
  Bug#31210 - INSERT DELAYED crashes server when used on
              partitioned table
  
  Not to be pushed. Internal commit. It does just hide the problem.
  
  Trying INSERT DELAYED on a partitioned table, that has not been
  used right before, crashes the server. When a table is used for
  select or update, it is kept open for some time. This period I
  mean with "right before".
  
  Information about partitioning of a table is stored in form of
  a string in the .frm file. Parsing of this string requires a
  correctly set up lexical analyzer (lex). The partitioning code
  uses a new temporary instance of a lex. But it does still refer
  to the previously active lex. The delayd insert thread does not
  initialize its lex though...
  
  Added initialization for thd->lex before open table in the delayed
  thread. This hides the crash. But lex handling of the partition
  code may still need a fix.

  mysql-test/r/partition_hash.result@stripped, 2007-10-12 12:28:07+02:00, istruewing@stripped +4 -0
    Bug#31210 - INSERT DELAYED crashes server when used on
                partitioned table
    Added test result

  mysql-test/t/partition_hash.test@stripped, 2007-10-12 12:28:07+02:00, istruewing@stripped +8 -0
    Bug#31210 - INSERT DELAYED crashes server when used on
                partitioned table
    Added test

  sql/sql_insert.cc@stripped, 2007-10-12 12:28:07+02:00, istruewing@stripped +6 -1
    Bug#31210 - INSERT DELAYED crashes server when used on
                partitioned table
    Added initialization for thd->lex before open table.

diff -Nrup a/mysql-test/r/partition_hash.result b/mysql-test/r/partition_hash.result
--- a/mysql-test/r/partition_hash.result	2007-04-04 16:26:24 +02:00
+++ b/mysql-test/r/partition_hash.result	2007-10-12 12:28:07 +02:00
@@ -183,3 +183,7 @@ c1	c2	c3
 182	abc	2002-11-09
 184	abc	2002-11-22
 drop table t1;
+CREATE TABLE t1 (c1 INT) ENGINE=MyISAM PARTITION BY HASH(c1) PARTITIONS 1;
+INSERT DELAYED INTO t1 VALUES (1);
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+DROP TABLE t1;
diff -Nrup a/mysql-test/t/partition_hash.test b/mysql-test/t/partition_hash.test
--- a/mysql-test/t/partition_hash.test	2007-07-02 18:08:23 +02:00
+++ b/mysql-test/t/partition_hash.test	2007-10-12 12:28:07 +02:00
@@ -144,3 +144,11 @@ select * from t1 where c3 between '2002-
 
 drop table t1;
 
+#
+# Bug#31210 - INSERT DELAYED crashes server when used on partitioned table
+#
+CREATE TABLE t1 (c1 INT) ENGINE=MyISAM PARTITION BY HASH(c1) PARTITIONS 1;
+--error ER_ILLEGAL_HA
+INSERT DELAYED INTO t1 VALUES (1);
+DROP TABLE t1;
+
diff -Nrup a/sql/sql_insert.cc b/sql/sql_insert.cc
--- a/sql/sql_insert.cc	2007-08-31 01:05:45 +02:00
+++ b/sql/sql_insert.cc	2007-10-12 12:28:07 +02:00
@@ -2264,7 +2264,12 @@ pthread_handler_t handle_delayed_insert(
     goto err;
   }
 
-  /* open table */
+  /*
+    Open table requires an initialized lex in case the table is
+    partitioned. The .frm file contains a partial SQL string which is
+    parsed using a lex, that depends on initialized thd->lex.
+  */
+  lex_start(thd);
   if (!(di->table=open_ltable(thd, &di->table_list, TL_WRITE_DELAYED, 0)))
   {
     thd->fatal_error();				// Abort waiting inserts
Thread
bk commit into 5.1 tree (istruewing:1.2571) BUG#31210Ingo Struewing12 Oct