List:Commits« Previous MessageNext Message »
From:Martin Skold Date:December 19 2006 3:54pm
Subject:bk commit into 5.1 tree (mskold:1.2367) BUG#24667
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of marty. When marty does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-12-19 15:53:46+01:00, mskold@stripped +7 -0
  bug#24667  After ALTER TABLE operation ndb_dd table becomes regular ndb: copy tablespace from old table in copying alter table

  mysql-test/r/ndb_dd_alter.result@stripped, 2006-12-19 15:53:11+01:00, mskold@stripped +10 -4
    bug#24667  After ALTER TABLE operation ndb_dd table becomes regular ndb: copy tablespace from old table in copying alter table

  mysql-test/t/ndb_dd_alter.test@stripped, 2006-12-19 15:53:11+01:00, mskold@stripped +4 -0
    bug#24667  After ALTER TABLE operation ndb_dd table becomes regular ndb: copy tablespace from old table in copying alter table

  sql/ha_ndbcluster.cc@stripped, 2006-12-19 15:53:10+01:00, mskold@stripped +8 -2
    bug#24667  After ALTER TABLE operation ndb_dd table becomes regular ndb: copy tablespace from old table in copying alter table

  sql/ha_ndbcluster.h@stripped, 2006-12-19 15:53:10+01:00, mskold@stripped +1 -1
    bug#24667  After ALTER TABLE operation ndb_dd table becomes regular ndb: copy tablespace from old table in copying alter table

  sql/handler.h@stripped, 2006-12-19 15:53:07+01:00, mskold@stripped +1 -1
    bug#24667  After ALTER TABLE operation ndb_dd table becomes regular ndb: copy tablespace from old table in copying alter table

  sql/sql_show.cc@stripped, 2006-12-19 15:53:09+01:00, mskold@stripped +2 -2
    bug#24667  After ALTER TABLE operation ndb_dd table becomes regular ndb: copy tablespace from old table in copying alter table

  sql/sql_table.cc@stripped, 2006-12-19 15:53:10+01:00, mskold@stripped +10 -1
    bug#24667  After ALTER TABLE operation ndb_dd table becomes regular ndb: copy tablespace from old table in copying alter table

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	mskold
# Host:	linux.site
# Root:	/windows/Linux_space/MySQL/mysql-5.1-new-ndb

--- 1.248/sql/handler.h	2006-12-19 15:54:03 +01:00
+++ 1.249/sql/handler.h	2006-12-19 15:54:03 +01:00
@@ -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; }

--- 1.379/sql/sql_show.cc	2006-12-19 15:54:03 +01:00
+++ 1.380/sql/sql_show.cc	2006-12-19 15:54:03 +01:00
@@ -1267,7 +1267,7 @@ int store_create_info(THD *thd, TABLE_LI
       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_reco
                               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);

--- 1.379/sql/sql_table.cc	2006-12-19 15:54:03 +01:00
+++ 1.380/sql/sql_table.cc	2006-12-19 15:54:03 +01:00
@@ -5307,7 +5307,7 @@ bool mysql_alter_table(THD *thd,char *ne
   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);

--- 1.2/mysql-test/r/ndb_dd_alter.result	2006-12-19 15:54:03 +01:00
+++ 1.3/mysql-test/r/ndb_dd_alter.result	2006-12-19 15:54:03 +01:00
@@ -282,7 +282,13 @@ a1
 18
 19
 20
+SELECT * FROM information_schema.partitions WHERE table_name= 't1' AND partition_name = 'p0';
+TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
+NULL	test	t1	p0	NULL	1	NULL	KEY	NULL		NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	default	ts
 ALTER TABLE test.t1 ADD a2 FLOAT, ADD a3 DOUBLE;
+SELECT * FROM information_schema.partitions WHERE table_name= 't1' AND partition_name = 'p0';
+TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
+NULL	test	t1	p0	NULL	1	NULL	KEY	NULL		NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	default	ts
 SELECT * FROM test.t1 ORDER BY a1;
 a1	a2	a3
 1	2.2345	20000001
@@ -369,7 +375,7 @@ t1	CREATE TABLE `t1` (
   `a13` text,
   `a14` blob,
   PRIMARY KEY (`a1`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
 ALTER TABLE test.t1 ADD INDEX a2_i (a2), ADD INDEX a3_i (a3);
 SHOW CREATE TABLE test.t1;
 Table	Create Table
@@ -391,7 +397,7 @@ t1	CREATE TABLE `t1` (
   PRIMARY KEY (`a1`),
   KEY `a2_i` (`a2`),
   KEY `a3_i` (`a3`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
 ALTER TABLE test.t1 DROP INDEX a2_i;
 SHOW CREATE TABLE test.t1;
 Table	Create Table
@@ -412,7 +418,7 @@ t1	CREATE TABLE `t1` (
   `a14` blob,
   PRIMARY KEY (`a1`),
   KEY `a3_i` (`a3`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
 ALTER TABLE test.t1 DROP a14;
 ALTER TABLE test.t1 DROP a13;
 ALTER TABLE test.t1 DROP a12;
@@ -432,7 +438,7 @@ t1	CREATE TABLE `t1` (
   `a4` bit(1) DEFAULT NULL,
   `a5` tinyint(4) DEFAULT NULL,
   KEY `a3_i` (`a3`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
 DROP TABLE test.t1;
 ALTER TABLESPACE ts
 DROP DATAFILE './table_space/datafile.dat'

--- 1.2/mysql-test/t/ndb_dd_alter.test	2006-12-19 15:54:03 +01:00
+++ 1.3/mysql-test/t/ndb_dd_alter.test	2006-12-19 15:54:03 +01:00
@@ -156,7 +156,11 @@ enable_query_log;
 
 SELECT * FROM test.t1 ORDER BY a1;
 
+SELECT * FROM information_schema.partitions WHERE table_name= 't1' AND partition_name = 'p0';
+
 ALTER TABLE test.t1 ADD a2 FLOAT, ADD a3 DOUBLE;
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't1' AND partition_name = 'p0';
 
 let $1=20;
 disable_query_log;

--- 1.378/sql/ha_ndbcluster.cc	2006-12-19 15:54:03 +01:00
+++ 1.379/sql/ha_ndbcluster.cc	2006-12-19 15:54:03 +01:00
@@ -9949,7 +9949,7 @@ int ha_ndbcluster::generate_scan_filter_
 /*
   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
     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)

--- 1.159/sql/ha_ndbcluster.h	2006-12-19 15:54:03 +01:00
+++ 1.160/sql/ha_ndbcluster.h	2006-12-19 15:54:03 +01:00
@@ -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,
Thread
bk commit into 5.1 tree (mskold:1.2367) BUG#24667Martin Skold19 Dec