From 92bfebb66eaddacd5d2dfa6cf749d721a921ff4c Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Fri, 20 Nov 2009 00:13:54 +0100 Subject: [PATCH] Bug#32115: Bad use of Name_resolution_context from current LEX in partitioning port from mysql-next (5.4) to mysql-next-mr-bugfixing (5.5/5.6?) 2755 Konstantin Osipov 2008-11-27 Bug#32115 will remove the pre-requisite to initialize LEX to open tables. This dependency was added in 5.1 and was supposed to be removed in 6.0. Remove asserts and initialization of LEX in places where we don't deal with partitioned tables. --- sql/event_scheduler.cc | 1 - sql/events.cc | 1 - sql/sp_head.cc | 2 +- sql/sql_acl.cc | 2 -- sql/sql_base.cc | 3 --- sql/sql_parse.cc | 1 - sql/sql_plugin.cc | 1 - sql/sql_servers.cc | 1 - sql/sql_udf.cc | 1 - sql/table.cc | 5 ++--- sql/tztime.cc | 1 - 11 files changed, 3 insertions(+), 16 deletions(-) diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index ea20270b457..d9ca161f260 100644 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -128,7 +128,6 @@ post_init_event_thread(THD *thd) thd->cleanup(); return TRUE; } - lex_start(thd); pthread_mutex_lock(&LOCK_thread_count); threads.append(thd); diff --git a/sql/events.cc b/sql/events.cc index f7ff2b0ccf1..ac37a2bd595 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -925,7 +925,6 @@ Events::init(my_bool opt_noacl_or_bootstrap) */ thd->thread_stack= (char*) &thd; thd->store_globals(); - lex_start(thd); /* We will need Event_db_repository anyway, even if the scheduler is diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 7cabae255cc..3d2486cd98f 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -4005,7 +4005,7 @@ sp_head::add_used_tables_to_table_list(THD *thd, /** - Simple function for adding an explicetly named (systems) table to + Simple function for adding an explicitly named (systems) table to the global table list, e.g. "mysql", "proc". */ diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 46d7f3ce89d..1e5eeec7dbc 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -276,7 +276,6 @@ my_bool acl_init(bool dont_read_acl_tables) DBUG_RETURN(1); /* purecov: inspected */ thd->thread_stack= (char*) &thd; thd->store_globals(); - lex_start(thd); /* It is safe to call acl_reload() since acl_* arrays and hashes which will be freed there are global static objects and thus are initialized @@ -3524,7 +3523,6 @@ my_bool grant_init() DBUG_RETURN(1); /* purecov: deadcode */ thd->thread_stack= (char*) &thd; thd->store_globals(); - lex_start(thd); return_val= grant_reload(thd); delete thd; /* Remember that we don't have a THD */ diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 2c0ba87262a..787ea3cdc92 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2532,9 +2532,6 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, HASH_SEARCH_STATE state; DBUG_ENTER("open_table"); - /* Parsing of partitioning information from .frm needs thd->lex set up. */ - DBUG_ASSERT(thd->lex->is_lex_started); - /* find a unused table in the open table cache */ if (refresh) *refresh=0; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1edb37026fb..094a715902f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7050,7 +7050,6 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, { thd->thread_stack= (char*) &tmp_thd; thd->store_globals(); - lex_start(thd); } if (thd) diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 936c9ae8866..d15c97de912 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1359,7 +1359,6 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv) } new_thd->thread_stack= (char*) &tables; new_thd->store_globals(); - lex_start(new_thd); new_thd->db= my_strdup("mysql", MYF(0)); new_thd->db_length= 5; bzero((uchar*)&tables, sizeof(tables)); diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc index e8fa3d984a7..8432b68a1d1 100644 --- a/sql/sql_servers.cc +++ b/sql/sql_servers.cc @@ -140,7 +140,6 @@ bool servers_init(bool dont_read_servers_table) DBUG_RETURN(TRUE); thd->thread_stack= (char*) &thd; thd->store_globals(); - lex_start(thd); /* It is safe to call servers_reload() since servers_* arrays and hashes which will be freed there are global static objects and thus are initialized diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index a1a0d9633b7..f38d8921181 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -135,7 +135,6 @@ void udf_init() initialized = 1; new_thd->thread_stack= (char*) &new_thd; new_thd->store_globals(); - lex_start(new_thd); new_thd->set_db(db, sizeof(db)-1); bzero((uchar*) &tables,sizeof(tables)); diff --git a/sql/table.cc b/sql/table.cc index 22b4b2f9b5e..600bd8bb33d 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1649,9 +1649,6 @@ 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; @@ -1833,6 +1830,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, thd->restore_active_arena(&part_func_arena, &backup_arena); goto partititon_err; } + /* fix_partition_func needs thd->lex set up. TODO: fix! */ + DBUG_ASSERT(thd->lex->is_lex_started); outparam->part_info->is_auto_partitioned= share->auto_partitioned; DBUG_PRINT("info", ("autopartitioned: %u", share->auto_partitioned)); /* we should perform the fix_partition_func in either local or diff --git a/sql/tztime.cc b/sql/tztime.cc index 650678c721b..d4b7ae4b73a 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1578,7 +1578,6 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) DBUG_RETURN(1); thd->thread_stack= (char*) &thd; thd->store_globals(); - lex_start(thd); /* Init all memory structures that require explicit destruction */ if (my_hash_init(&tz_names, &my_charset_latin1, 20,