From 3eaf82a17504158aa29b1f39360f365428943de4 Mon Sep 17 00:00:00 2001 From: "istruewing@stella.local" <> Date: Mon, 5 Nov 2007 16:25:40 +0100 Subject: 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. --- sql/table.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql/table.cc') diff --git a/sql/table.cc b/sql/table.cc index ccddbf8134b..26008f0aa19 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1608,6 +1608,9 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, DBUG_PRINT("enter",("name: '%s.%s' form: 0x%lx", share->db.str, share->table_name.str, (long) outparam)); + /* Parsing of partitioning information from .frm needs thd->lex set up. */ + DBUG_ASSERT(thd->lex->is_lex_started); + error= 1; bzero((char*) outparam, sizeof(*outparam)); outparam->in_use= thd; -- cgit v1.2.1