From efd6779c8011158700dffa53bf6c18c1af21f446 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Mon, 13 Feb 2006 21:55:49 +0100 Subject: [PATCH] Bug #17340 SHOW CREATE TABLE from second session crashes the server - no check was made that ndb thd object was allocated --- sql/ha_ndbcluster.cc | 8 ++++---- sql/ha_ndbcluster.h | 2 +- sql/handler.h | 2 +- sql/sql_show.cc | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 9121ab9a093..1b1b16f4ae4 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -8915,9 +8915,9 @@ ha_ndbcluster::generate_scan_filter(Ndb_cond_stack *ndb_cond_stack, /* 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(); NdbError ndberr; Uint32 id; @@ -8941,11 +8941,11 @@ char* ha_ndbcluster::get_tablespace_name() } err: 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), ndberr.code, ndberr.message, "NDB"); 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), ndberr.code, ndberr.message, "NDB"); return 0; diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 12a5be32881..1eb8ac1ea70 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -724,7 +724,7 @@ private: uint set_up_partition_info(partition_info *part_info, TABLE *table, void *tab); - char* get_tablespace_name(); + char* get_tablespace_name(THD *thd); int set_range_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, diff --git a/sql/handler.h b/sql/handler.h index a8804bdba17..55af6cf4da6 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1712,7 +1712,7 @@ public: { return FALSE; } virtual char* get_foreign_key_create_info() { 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 */ /* used in ALTER TABLE; 1 if changing storage engine is allowed */ virtual bool can_switch_engines() { return 1; } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index d31d686e38d..387e5e4fcfb 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1138,7 +1138,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, 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(for_str, strlen(for_str));