List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:March 4 2011 8:29am
Subject:Re: bzr commit into mysql-5.5 branch (magnus.blaudd:3353) Bug#60111
View as plain text  
On 03/02/2011 09:39 AM, Sergey Vojtovich wrote:
>> === added file 'mysql-test/r/tablespace.result'
>> >  --- a/mysql-test/r/tablespace.result	1970-01-01 00:00:00 +0000
>> >  +++ b/mysql-test/r/tablespace.result	2011-02-23 13:15:08 +0000
>> >  @@ -0,0 +1,112 @@
> ...skip...
>> >  +CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
>> >  +ALTER TABLE t1 ADD COLUMN b int;
>> >  +SHOW CREATE TABLE t1;
>> >  +Table	Create Table
>> >  +t1	CREATE TABLE `t1` (
>> >  +  `a` int(11) DEFAULT NULL,
>> >  +  `b` int(11) DEFAULT NULL
>> >  +) /*!50100 TABLESPACE ts */ ENGINE=MyISAM DEFAULT CHARSET=latin1
>> >  +DROP TABLE t1;
> Why no STORAGE DISK?

Hi Svoj,

you uncovered a bug in 'prepare_alter_table', the TABLESPACE and STORAGE 
was not copied to create_info properly.

Below is the patch, which:
1) removes the assumption that tablespace is only copied when STORAGE == 
DISK
2) copied the STORAGE from share to HA_CREATE_INFO if not specified in 
ALTER.

Once again removing one place using get_tablespace_name so it's not only 
one left in 'store_schema_partitions_record' in sql_show.cc, do you want 
me to get rid of it completely?


=== modified file 'sql/sql_table.cc'
--- sql/sql_table.cc	2011-01-26 13:23:29 +0000
+++ sql/sql_table.cc	2011-03-04 08:05:46 +0000
@@ -5281,17 +5281,12 @@ mysql_prepare_alter_table(THD *thd, TABL
    if (!(used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE))
      create_info->key_block_size= table->s->key_block_size;

-  if (!create_info->tablespace && create_info->storage_media != 
HA_SM_MEMORY)
-  {
-    char *tablespace= static_cast<char *>(thd->alloc(FN_LEN + 1));
-    /*
-       Regular alter table of disk stored table (no tablespace/storage 
change)
-       Copy tablespace name
-    */
-    if (tablespace &&
-        (table->file->get_tablespace_name(thd, tablespace, FN_LEN)))
-      create_info->tablespace= tablespace;
-  }
+  if (!create_info->tablespace)
+    create_info->tablespace= table->s->tablespace;
+
+  if (create_info->storage_media == HA_SM_DEFAULT)
+    create_info->storage_media= table->s->default_storage_media;
+
    restore_record(table, s->default_values);     // Empty record for 
DEFAULT
    Create_field *def;


/ Magnus
Thread
bzr commit into mysql-5.5 branch (magnus.blaudd:3353) Bug#60111Magnus Blåudd23 Feb
Re: bzr commit into mysql-5.5 branch (magnus.blaudd:3353) Bug#60111Magnus Blåudd2 Mar
  • Re: bzr commit into mysql-5.5 branch (magnus.blaudd:3353) Bug#60111Sergey Vojtovich2 Mar
    • Re: bzr commit into mysql-5.5 branch (magnus.blaudd:3353) Bug#60111Magnus Blåudd2 Mar
Re: bzr commit into mysql-5.5 branch (magnus.blaudd:3353) Bug#60111Magnus Blåudd4 Mar
  • Re: bzr commit into mysql-5.5 branch (magnus.blaudd:3353) Bug#60111Sergey Vojtovich4 Mar
Re: bzr commit into mysql-5.5 branch (magnus.blaudd:3353) Bug#60111Dmitry Lenev10 Mar
  • Re: bzr commit into mysql-5.5 branch (magnus.blaudd:3353) Bug#60111Magnus Blåudd18 Mar
    • Re: bzr commit into mysql-5.5 branch (magnus.blaudd:3353) Bug#60111Dmitry Lenev21 Mar
      • Re: bzr commit into mysql-5.5 branch (magnus.blaudd:3353) Bug#60111Magnus Blåudd21 Mar