Commit 176cabc1 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.

sql/sp_head.cc:
  Fix a typo.
parent 27fca0ab
......@@ -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);
......
......@@ -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
......
......@@ -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".
*/
......
......@@ -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 */
......
......@@ -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;
......
......@@ -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)
......
......@@ -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));
......
......@@ -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
......
......@@ -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));
......
......@@ -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
......
......@@ -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,
......
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