Commit f5131b2f authored by unknown's avatar unknown
Browse files

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
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -724,7 +724,7 @@ static void set_tabname(const char *pathname, char *tabname);
  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,
+1 −1
Original line number Diff line number Diff line
@@ -1712,7 +1712,7 @@ class handler :public Sql_alloc
  { 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; }
+1 −1
Original line number Diff line number Diff line
@@ -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));