Commit f5131b2f authored by unknown's avatar unknown

Bug #17340 SHOW CREATE TABLE from second session crashes the server

- no check was made that ndb thd object was allocated


sql/ha_ndbcluster.h:
  Bug #17340  	SHOW CREATE TABLE from second session crashes the server
sql/handler.h:
  Bug #17340  	SHOW CREATE TABLE from second session crashes the server
sql/sql_show.cc:
  Bug #17340  	SHOW CREATE TABLE from second session crashes the server
parent 97243651
...@@ -8915,9 +8915,9 @@ ha_ndbcluster::generate_scan_filter(Ndb_cond_stack *ndb_cond_stack, ...@@ -8915,9 +8915,9 @@ ha_ndbcluster::generate_scan_filter(Ndb_cond_stack *ndb_cond_stack,
/* /*
get table space info for SHOW CREATE TABLE get table space info for SHOW CREATE TABLE
*/ */
char* ha_ndbcluster::get_tablespace_name() char* ha_ndbcluster::get_tablespace_name(THD *thd)
{ {
Ndb *ndb= get_ndb(); Ndb *ndb= check_ndb_in_thd(thd);
NDBDICT *ndbdict= ndb->getDictionary(); NDBDICT *ndbdict= ndb->getDictionary();
NdbError ndberr; NdbError ndberr;
Uint32 id; Uint32 id;
...@@ -8941,11 +8941,11 @@ char* ha_ndbcluster::get_tablespace_name() ...@@ -8941,11 +8941,11 @@ char* ha_ndbcluster::get_tablespace_name()
} }
err: err:
if (ndberr.status == NdbError::TemporaryError) if (ndberr.status == NdbError::TemporaryError)
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_GET_TEMPORARY_ERRMSG, ER(ER_GET_TEMPORARY_ERRMSG), ER_GET_TEMPORARY_ERRMSG, ER(ER_GET_TEMPORARY_ERRMSG),
ndberr.code, ndberr.message, "NDB"); ndberr.code, ndberr.message, "NDB");
else else
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_GET_ERRMSG, ER(ER_GET_ERRMSG), ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
ndberr.code, ndberr.message, "NDB"); ndberr.code, ndberr.message, "NDB");
return 0; return 0;
......
...@@ -724,7 +724,7 @@ static void set_tabname(const char *pathname, char *tabname); ...@@ -724,7 +724,7 @@ static void set_tabname(const char *pathname, char *tabname);
uint set_up_partition_info(partition_info *part_info, uint set_up_partition_info(partition_info *part_info,
TABLE *table, TABLE *table,
void *tab); void *tab);
char* get_tablespace_name(); char* get_tablespace_name(THD *thd);
int set_range_data(void *tab, partition_info* part_info); int set_range_data(void *tab, partition_info* part_info);
int set_list_data(void *tab, partition_info* part_info); int set_list_data(void *tab, partition_info* part_info);
int complemented_pk_read(const byte *old_data, byte *new_data, int complemented_pk_read(const byte *old_data, byte *new_data,
......
...@@ -1712,7 +1712,7 @@ class handler :public Sql_alloc ...@@ -1712,7 +1712,7 @@ class handler :public Sql_alloc
{ return FALSE; } { return FALSE; }
virtual char* get_foreign_key_create_info() virtual char* get_foreign_key_create_info()
{ return(NULL);} /* gets foreign key create string from InnoDB */ { return(NULL);} /* gets foreign key create string from InnoDB */
virtual char* get_tablespace_name() virtual char* get_tablespace_name(THD *thd)
{ return(NULL);} /* gets tablespace name from handler */ { return(NULL);} /* gets tablespace name from handler */
/* used in ALTER TABLE; 1 if changing storage engine is allowed */ /* used in ALTER TABLE; 1 if changing storage engine is allowed */
virtual bool can_switch_engines() { return 1; } virtual bool can_switch_engines() { return 1; }
......
...@@ -1138,7 +1138,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, ...@@ -1138,7 +1138,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
to the CREATE TABLE statement to the CREATE TABLE statement
*/ */
if ((for_str= file->get_tablespace_name())) if ((for_str= file->get_tablespace_name(thd)))
{ {
packet->append(" TABLESPACE "); packet->append(" TABLESPACE ");
packet->append(for_str, strlen(for_str)); packet->append(for_str, strlen(for_str));
......
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