List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:February 12 2009 3:22pm
Subject:bzr commit into mysql-5.1-telco-6.4 branch (jonas:3259)
View as plain text  
#At file:///home/jonas/src/telco-6.4/

 3259 Jonas Oreland	2009-02-12 [merge]
      merge 63 to 64
modified:
  mysql-test/suite/ndb/r/ndb_add_partition.result
  mysql-test/suite/ndb/r/ndb_alter_table_online.result
  mysql-test/suite/ndb/r/ndb_dd_alter.result
  mysql-test/suite/ndb/t/ndb_add_partition.test
  mysql-test/suite/ndb/t/ndb_alter_table_online.test
  sql/ha_ndbcluster.cc
  sql/sql_table.cc

=== modified file 'mysql-test/suite/ndb/r/ndb_add_partition.result'
--- a/mysql-test/suite/ndb/r/ndb_add_partition.result	2008-12-22 09:40:33 +0000
+++ b/mysql-test/suite/ndb/r/ndb_add_partition.result	2009-02-12 15:21:46 +0000
@@ -17,10 +17,11 @@ ENGINE = NDB
 partition by key(a);
 CREATE TABLE t2 (a int unsigned not null,
 b int unsigned not null,
-c int unsigned not null storage DISK,
+c int unsigned not null,
 primary key(a,b),
 unique (b))
 ENGINE = NDB
+STORAGE DISK
 TABLESPACE ts1
 partition by key(a);
 INSERT INTO t1 VALUES

=== modified file 'mysql-test/suite/ndb/r/ndb_alter_table_online.result'
--- a/mysql-test/suite/ndb/r/ndb_alter_table_online.result	2008-12-11 14:32:35 +0000
+++ b/mysql-test/suite/ndb/r/ndb_alter_table_online.result	2009-02-12 15:21:46 +0000
@@ -657,6 +657,15 @@ ERROR 42000: This version of MySQL doesn
 ALTER ONLINE TABLE t1 ADD COLUMN h VARBINARY(20) COLUMN_FORMAT DYNAMIC;
 ERROR 42000: This version of MySQL doesn't yet support 'ALTER ONLINE TABLE t1 ADD COLUMN h VARBINARY(20) COLUMN_FORMAT DYNAMIC'
 DROP TABLE t1;
+create table t1 (a int primary key, b int) storage disk tablespace ts1 engine = ndb;
+alter online table t1 add column c0 int null column_format DYNAMIC;
+ERROR 42000: This version of MySQL doesn't yet support 'alter online table t1 add column c0 int null column_format DYNAMIC'
+alter online table t1 add column c1 int null column_format DYNAMIC storage memory;
+drop table t1;
+create table t1 (a int primary key, b int storage disk) tablespace ts1 engine = ndb;
+alter online table t1 add column c0 int null column_format DYNAMIC;
+alter online table t1 add column c1 int null column_format DYNAMIC storage memory;
+drop table t1;
 ALTER TABLESPACE ts1
 DROP DATAFILE 'datafile.dat'
 ENGINE = NDB;

=== modified file 'mysql-test/suite/ndb/r/ndb_dd_alter.result'
--- a/mysql-test/suite/ndb/r/ndb_dd_alter.result	2008-12-22 14:21:46 +0000
+++ b/mysql-test/suite/ndb/r/ndb_dd_alter.result	2009-02-12 15:21:46 +0000
@@ -316,9 +316,6 @@ SELECT * FROM information_schema.partiti
 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	ts
 ALTER TABLE test.t1 ADD a2 FLOAT, ADD a3 DOUBLE;
-Warnings:
-Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
-Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 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	ts
@@ -345,12 +342,6 @@ a1	a2	a3
 19	20.2345	20000019
 20	21.2345	20000020
 ALTER TABLE test.t1  ADD a4 BIT, ADD a5 TINYINT, ADD a6 BIGINT, ADD a7 DATE, ADD a8 TIME;
-Warnings:
-Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
-Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
-Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
-Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
-Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 SELECT a1,a2,a3,hex(a4), a5,a6,a7,a8 FROM test.t1 ORDER BY a1;
 a1	a2	a3	hex(a4)	a5	a6	a7	a8
 1	2.2345	20000001	0	1	23457	2006-01-01	07:04:00

=== modified file 'mysql-test/suite/ndb/t/ndb_add_partition.test'
--- a/mysql-test/suite/ndb/t/ndb_add_partition.test	2008-12-22 09:40:33 +0000
+++ b/mysql-test/suite/ndb/t/ndb_add_partition.test	2009-02-12 15:21:46 +0000
@@ -25,10 +25,11 @@ partition by key(a);
 
 CREATE TABLE t2 (a int unsigned not null,
                  b int unsigned not null,
-                 c int unsigned not null storage DISK,
+                 c int unsigned not null,
                  primary key(a,b),
                  unique (b))
 ENGINE = NDB
+STORAGE DISK
 TABLESPACE ts1
 partition by key(a);
 

=== modified file 'mysql-test/suite/ndb/t/ndb_alter_table_online.test'
--- a/mysql-test/suite/ndb/t/ndb_alter_table_online.test	2008-12-12 08:17:45 +0000
+++ b/mysql-test/suite/ndb/t/ndb_alter_table_online.test	2009-02-12 15:21:46 +0000
@@ -684,6 +684,20 @@ ALTER ONLINE TABLE t1 ADD COLUMN h BINAR
 ALTER ONLINE TABLE t1 ADD COLUMN h VARBINARY(20) COLUMN_FORMAT DYNAMIC;
 DROP TABLE t1;
 
+#
+# bug#42549
+#
+create table t1 (a int primary key, b int) storage disk tablespace ts1 engine = ndb;
+--error ER_NOT_SUPPORTED_YET
+alter online table t1 add column c0 int null column_format DYNAMIC;
+alter online table t1 add column c1 int null column_format DYNAMIC storage memory;
+drop table t1;
+
+create table t1 (a int primary key, b int storage disk) tablespace ts1 engine = ndb;
+alter online table t1 add column c0 int null column_format DYNAMIC;
+alter online table t1 add column c1 int null column_format DYNAMIC storage memory;
+drop table t1;
+
 ALTER TABLESPACE ts1
 DROP DATAFILE 'datafile.dat'
 ENGINE = NDB;

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2009-02-11 20:45:23 +0000
+++ b/sql/ha_ndbcluster.cc	2009-02-12 15:21:46 +0000
@@ -11984,6 +11984,16 @@ int ha_ndbcluster::check_if_supported_al
        /*
          Check that we are only adding columns
        */
+       /*
+         HA_COLUMN_STORAGE & HA_COLUMN_FORMAT
+         are set if they are specified in an later cmd
+         even if they're no change. This is probably a bug
+         conclusion: add them to add_column-mask, so that we silently "accept" them
+         In case of someone trying to change a column, the HA_CHANGE_COLUMN would be set
+         which we don't support, so we will still return HA_ALTER_NOT_SUPPORTED in those cases
+       */
+       add_column.set_bit(HA_COLUMN_STORAGE);
+       add_column.set_bit(HA_COLUMN_FORMAT);
        if ((*alter_flags & ~add_column).is_set())
        {
          DBUG_PRINT("info", ("Only add column exclusively can be performed on-line"));
@@ -12070,6 +12080,22 @@ int ha_ndbcluster::check_if_supported_al
     const NDBCOL *col= tab->getColumn(i);
 
     create_ndb_column(0, new_col, field, create_info);
+
+    /**
+     * This is a "copy" of code in ::create()
+     *   that "auto-converts" columns with keys into memory
+     *   (unless storage disk is explicitly added)
+     * This is needed to check if getStorageType() == getStorageType() further down
+     */
+    if (field->flags & (PRI_KEY_FLAG | UNIQUE_KEY_FLAG | MULTIPLE_KEY_FLAG))
+    {
+      if (field->field_storage_type() == HA_SM_DISK)
+      {
+        DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+      }
+      new_col.setStorageType(NdbDictionary::Column::StorageTypeMemory);
+    }
+
     if (col->getStorageType() != new_col.getStorageType())
     {
       DBUG_PRINT("info", ("Column storage media is changed"));

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2009-01-23 12:21:02 +0000
+++ b/sql/sql_table.cc	2009-02-12 15:21:46 +0000
@@ -5818,21 +5818,6 @@ int create_temporary_table(THD *thd,
   else
     create_info->data_file_name=create_info->index_file_name=0;
 
-  if (new_db_type == old_db_type)
-  {
-    /*
-       Table has not changed storage engine.
-       If STORAGE and TABLESPACE have not been changed than copy them
-       from the original table
-    */
-    if (!create_info->tablespace &&
-        table->s->tablespace &&
-        create_info->default_storage_media == HA_SM_DEFAULT)
-      create_info->tablespace= table->s->tablespace;
-    if (create_info->default_storage_media == HA_SM_DEFAULT)
-      create_info->default_storage_media= table->s->default_storage_media;
-   }
-
   /*
     Create a table with a temporary name.
     With create_info->frm_only == 1 this creates a .frm file only.
@@ -6448,6 +6433,22 @@ mysql_prepare_alter_table(THD *thd, TABL
   if (table->s->tmp_table)
     create_info->options|=HA_LEX_CREATE_TMP_TABLE;
 
+  if (create_info->db_type == table->s->db_type())
+  {
+    /*
+       Table has not changed storage engine.
+       If STORAGE and TABLESPACE have not been changed than copy them
+       from the original table
+    */
+    if (!create_info->tablespace &&
+        table->s->tablespace &&
+        create_info->default_storage_media == HA_SM_DEFAULT)
+      create_info->tablespace= table->s->tablespace;
+
+    if (create_info->default_storage_media == HA_SM_DEFAULT)
+      create_info->default_storage_media= table->s->default_storage_media;
+  }
+
   rc= FALSE;
   alter_info->create_list.swap(new_create_list);
   alter_info->key_list.swap(new_key_list);

Thread
bzr commit into mysql-5.1-telco-6.4 branch (jonas:3259)Jonas Oreland12 Feb