Commit 92bfebb6 authored by Mattias Jonsson's avatar Mattias Jonsson

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.
parent 408dd52a
...@@ -128,7 +128,6 @@ post_init_event_thread(THD *thd) ...@@ -128,7 +128,6 @@ post_init_event_thread(THD *thd)
thd->cleanup(); thd->cleanup();
return TRUE; return TRUE;
} }
lex_start(thd);
pthread_mutex_lock(&LOCK_thread_count); pthread_mutex_lock(&LOCK_thread_count);
threads.append(thd); threads.append(thd);
......
...@@ -925,7 +925,6 @@ Events::init(my_bool opt_noacl_or_bootstrap) ...@@ -925,7 +925,6 @@ Events::init(my_bool opt_noacl_or_bootstrap)
*/ */
thd->thread_stack= (char*) &thd; thd->thread_stack= (char*) &thd;
thd->store_globals(); thd->store_globals();
lex_start(thd);
/* /*
We will need Event_db_repository anyway, even if the scheduler is We will need Event_db_repository anyway, even if the scheduler is
......
...@@ -4005,7 +4005,7 @@ sp_head::add_used_tables_to_table_list(THD *thd, ...@@ -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". the global table list, e.g. "mysql", "proc".
*/ */
......
...@@ -276,7 +276,6 @@ my_bool acl_init(bool dont_read_acl_tables) ...@@ -276,7 +276,6 @@ my_bool acl_init(bool dont_read_acl_tables)
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
thd->thread_stack= (char*) &thd; thd->thread_stack= (char*) &thd;
thd->store_globals(); thd->store_globals();
lex_start(thd);
/* /*
It is safe to call acl_reload() since acl_* arrays and hashes which 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 will be freed there are global static objects and thus are initialized
...@@ -3524,7 +3523,6 @@ my_bool grant_init() ...@@ -3524,7 +3523,6 @@ my_bool grant_init()
DBUG_RETURN(1); /* purecov: deadcode */ DBUG_RETURN(1); /* purecov: deadcode */
thd->thread_stack= (char*) &thd; thd->thread_stack= (char*) &thd;
thd->store_globals(); thd->store_globals();
lex_start(thd);
return_val= grant_reload(thd); return_val= grant_reload(thd);
delete thd; delete thd;
/* Remember that we don't have a THD */ /* Remember that we don't have a THD */
......
...@@ -2532,9 +2532,6 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, ...@@ -2532,9 +2532,6 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
HASH_SEARCH_STATE state; HASH_SEARCH_STATE state;
DBUG_ENTER("open_table"); 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 */ /* find a unused table in the open table cache */
if (refresh) if (refresh)
*refresh=0; *refresh=0;
......
...@@ -7050,7 +7050,6 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, ...@@ -7050,7 +7050,6 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
{ {
thd->thread_stack= (char*) &tmp_thd; thd->thread_stack= (char*) &tmp_thd;
thd->store_globals(); thd->store_globals();
lex_start(thd);
} }
if (thd) if (thd)
......
...@@ -1359,7 +1359,6 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv) ...@@ -1359,7 +1359,6 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv)
} }
new_thd->thread_stack= (char*) &tables; new_thd->thread_stack= (char*) &tables;
new_thd->store_globals(); new_thd->store_globals();
lex_start(new_thd);
new_thd->db= my_strdup("mysql", MYF(0)); new_thd->db= my_strdup("mysql", MYF(0));
new_thd->db_length= 5; new_thd->db_length= 5;
bzero((uchar*)&tables, sizeof(tables)); bzero((uchar*)&tables, sizeof(tables));
......
...@@ -140,7 +140,6 @@ bool servers_init(bool dont_read_servers_table) ...@@ -140,7 +140,6 @@ bool servers_init(bool dont_read_servers_table)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
thd->thread_stack= (char*) &thd; thd->thread_stack= (char*) &thd;
thd->store_globals(); thd->store_globals();
lex_start(thd);
/* /*
It is safe to call servers_reload() since servers_* arrays and hashes which 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 will be freed there are global static objects and thus are initialized
......
...@@ -135,7 +135,6 @@ void udf_init() ...@@ -135,7 +135,6 @@ void udf_init()
initialized = 1; initialized = 1;
new_thd->thread_stack= (char*) &new_thd; new_thd->thread_stack= (char*) &new_thd;
new_thd->store_globals(); new_thd->store_globals();
lex_start(new_thd);
new_thd->set_db(db, sizeof(db)-1); new_thd->set_db(db, sizeof(db)-1);
bzero((uchar*) &tables,sizeof(tables)); bzero((uchar*) &tables,sizeof(tables));
......
...@@ -1649,9 +1649,6 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, ...@@ -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, DBUG_PRINT("enter",("name: '%s.%s' form: 0x%lx", share->db.str,
share->table_name.str, (long) outparam)); 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; error= 1;
bzero((char*) outparam, sizeof(*outparam)); bzero((char*) outparam, sizeof(*outparam));
outparam->in_use= thd; outparam->in_use= thd;
...@@ -1833,6 +1830,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, ...@@ -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); thd->restore_active_arena(&part_func_arena, &backup_arena);
goto partititon_err; 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; outparam->part_info->is_auto_partitioned= share->auto_partitioned;
DBUG_PRINT("info", ("autopartitioned: %u", share->auto_partitioned)); DBUG_PRINT("info", ("autopartitioned: %u", share->auto_partitioned));
/* we should perform the fix_partition_func in either local or /* we should perform the fix_partition_func in either local or
......
...@@ -1578,7 +1578,6 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) ...@@ -1578,7 +1578,6 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
DBUG_RETURN(1); DBUG_RETURN(1);
thd->thread_stack= (char*) &thd; thd->thread_stack= (char*) &thd;
thd->store_globals(); thd->store_globals();
lex_start(thd);
/* Init all memory structures that require explicit destruction */ /* Init all memory structures that require explicit destruction */
if (my_hash_init(&tz_names, &my_charset_latin1, 20, if (my_hash_init(&tz_names, &my_charset_latin1, 20,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment