diff options
author | unknown <mskold/marty@mysql.com/linux.site> | 2006-12-19 15:53:46 +0100 |
---|---|---|
committer | unknown <mskold/marty@mysql.com/linux.site> | 2006-12-19 15:53:46 +0100 |
commit | 1e10672496fbce277cab2f38a98476e6c25ee2f5 (patch) | |
tree | b2e6376d81b4875d99b6b50f86e69c1b964b1c7c /sql | |
parent | 17472067297969aa5d8d8cc462279907f3638776 (diff) | |
download | mariadb-git-1e10672496fbce277cab2f38a98476e6c25ee2f5.tar.gz |
bug#24667 After ALTER TABLE operation ndb_dd table becomes regular ndb: copy tablespace from old table in copying alter table
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_ndbcluster.cc | 10 | ||||
-rw-r--r-- | sql/ha_ndbcluster.h | 2 | ||||
-rw-r--r-- | sql/handler.h | 2 | ||||
-rw-r--r-- | sql/sql_show.cc | 4 | ||||
-rw-r--r-- | sql/sql_table.cc | 11 |
5 files changed, 22 insertions, 7 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index fb091664e93..b2a4357425b 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -9949,7 +9949,7 @@ int ha_ndbcluster::generate_scan_filter_from_key(NdbScanOperation *op, /* get table space info for SHOW CREATE TABLE */ -char* ha_ndbcluster::get_tablespace_name(THD *thd) +char* ha_ndbcluster::get_tablespace_name(THD *thd, char* name) { Ndb *ndb= check_ndb_in_thd(thd); NDBDICT *ndbdict= ndb->getDictionary(); @@ -9967,7 +9967,13 @@ char* ha_ndbcluster::get_tablespace_name(THD *thd) ndberr= ndbdict->getNdbError(); if(ndberr.classification != NdbError::NoError) goto err; - return (my_strdup(ts.getName(), MYF(0))); + if (name) + { + strxnmov(name, FN_LEN, ts.getName(), NullS); + return name; + } + else + return (my_strdup(ts.getName(), MYF(0))); } err: if (ndberr.status == NdbError::TemporaryError) diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index ed9e5ea41cc..54c642e8273 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -824,7 +824,7 @@ private: uint set_up_partition_info(partition_info *part_info, TABLE *table, void *tab); - char* get_tablespace_name(THD *thd); + char* get_tablespace_name(THD *thd, char *name); int set_range_data(void *tab, partition_info* part_info); int set_list_data(void *tab, partition_info* part_info); int complemented_read(const byte *old_data, byte *new_data, diff --git a/sql/handler.h b/sql/handler.h index f27912f4d1e..b9411ba108a 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1410,7 +1410,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(THD *thd) + virtual char* get_tablespace_name(THD *thd, char *name) { 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 0ebccba43ca..af02ccf1348 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1267,7 +1267,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, to the CREATE TABLE statement */ - if ((for_str= file->get_tablespace_name(thd))) + if ((for_str= file->get_tablespace_name(thd,0))) { packet->append(STRING_WITH_LEN(" /*!50100 TABLESPACE ")); packet->append(for_str, strlen(for_str)); @@ -3974,7 +3974,7 @@ static void store_schema_partitions_record(THD *thd, TABLE *schema_table, strlen(part_elem->tablespace_name), cs); else { - char *ts= showing_table->file->get_tablespace_name(thd); + char *ts= showing_table->file->get_tablespace_name(thd,0); if(ts) { table->field[24]->store(ts, strlen(ts), cs); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index c8f6e09fecb..930c84361ed 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5307,7 +5307,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, int error; char tmp_name[80],old_name[32],new_name_buff[FN_REFLEN]; char new_alias_buff[FN_REFLEN], *table_name, *db, *new_alias, *alias; - char index_file[FN_REFLEN], data_file[FN_REFLEN]; + char index_file[FN_REFLEN], data_file[FN_REFLEN], tablespace[FN_LEN]; char path[FN_REFLEN]; char reg_path[FN_REFLEN+1]; ha_rows copied,deleted; @@ -5630,6 +5630,15 @@ view_err: if (!(used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)) create_info->key_block_size= table->s->key_block_size; + if (!create_info->tablespace) + { + /* + Regular alter table of disk stored table (no tablespace change) + Copy tablespace name + */ + if (table->file->get_tablespace_name(thd, (char *) &tablespace)) + create_info->tablespace= (char *) &tablespace; + } restore_record(table, s->default_values); // Empty record for DEFAULT List_iterator<Alter_drop> drop_it(alter_info->drop_list); List_iterator<create_field> def_it(fields); |