OK to push, the only comment I have is a proposal for a new error
message, since it might be hard to understand.
This fix do solve some other strange things I think I have seen before.
Good work!
/Mattias
Ingo Struewing wrote:
> 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-11-05 16:25:40+01:00, istruewing@stripped +17 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
>
> 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 and at all other places where it is necessary to call
> lex_start() if all tables would be partitioned and need to parse
> the .frm file.
>
> mysql-test/r/partition_hash.result@stripped, 2007-11-05 16:25:38+01: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-11-05 16:25:38+01:00,
> istruewing@stripped +8 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Added test
>
> sql/event_scheduler.cc@stripped, 2007-11-05 16:25:38+01:00, istruewing@stripped +1
> -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Initialized lex for later use in open_table().
>
> sql/events.cc@stripped, 2007-11-05 16:25:38+01:00, istruewing@stripped +1 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Initialized lex for later use in open_table().
>
> sql/ha_ndbcluster_binlog.cc@stripped, 2007-11-05 16:25:38+01:00,
> istruewing@stripped +1 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Initialized lex for later use in open_table().
>
> sql/slave.cc@stripped, 2007-11-05 16:25:38+01:00, istruewing@stripped +1 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Initialized lex for later use in open_table().
>
> sql/sql_acl.cc@stripped, 2007-11-05 16:25:38+01:00, istruewing@stripped +2 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Initialized lex for later use in open_table().
>
> sql/sql_base.cc@stripped, 2007-11-05 16:25:38+01:00, istruewing@stripped +3 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Asserted that lex is initialized in open_table().
>
> sql/sql_connect.cc@stripped, 2007-11-05 16:25:38+01:00, istruewing@stripped +1 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Initialized lex for later use in open_table().
>
> sql/sql_insert.cc@stripped, 2007-11-05 16:25:38+01:00, istruewing@stripped +6 -1
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Added initialization for thd->lex before open table.
>
> sql/sql_lex.cc@stripped, 2007-11-05 16:25:38+01:00, istruewing@stripped +2 -1
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Added 'is_lex_started' to test if lex is initialized.
>
> sql/sql_lex.h@stripped, 2007-11-05 16:25:38+01:00, istruewing@stripped +1 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Added 'is_lex_started' to test if lex is initialized.
>
> sql/sql_plugin.cc@stripped, 2007-11-05 16:25:38+01:00, istruewing@stripped +1 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Initialized lex for later use in open_table().
>
> sql/sql_servers.cc@stripped, 2007-11-05 16:25:38+01:00, istruewing@stripped +1 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Initialized lex for later use in open_table().
>
> sql/sql_udf.cc@stripped, 2007-11-05 16:25:38+01:00, istruewing@stripped +1 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Initialized lex for later use in open_table().
>
> sql/table.cc@stripped, 2007-11-05 16:25:39+01:00, istruewing@stripped +3 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Asserted that lex is initialized in open_table_from_share().
>
> sql/tztime.cc@stripped, 2007-11-05 16:25:39+01:00, istruewing@stripped +1 -0
> Bug#31210 - INSERT DELAYED crashes server when used on
> partitioned table
> Initialized lex for later use in 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-11-05 16:25:38 +01: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
what option? (might an inexperienced mysql user think.)
But I believe this a what other storage engines say, so never mind.
> +DROP TABLE t1;
--
Mattias Jonsson, Software Engineer
MySQL AB, www.mysql.com
Are you MySQL certified? www.mysql.com/certification