4892 Martin Skold 2012-03-19
Bug#13830980 MYSQL COMPLAINS OF NOT SUPPORTING ALTER ONLINE EVEN WHEN VALID OPTIONS ARE USED: Added support of adding columns with a default value defined and moved check that it currently has to be null to ndbapi
modified:
mysql-test/suite/ndb/r/ndb_alter_table_online.result
mysql-test/suite/ndb/t/ndb_alter_table_online.test
sql/ha_ndbcluster.cc
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
4891 Jonas Oreland 2012-03-16
ndb - autotest - perform early filtering away of illegal index combinations (due to extra bit columns added to T6)
modified:
storage/ndb/test/ndbapi/testIndex.cpp
=== modified file 'mysql-test/suite/ndb/r/ndb_alter_table_online.result'
--- a/mysql-test/suite/ndb/r/ndb_alter_table_online.result 2011-06-17 10:15:34 +0000
+++ b/mysql-test/suite/ndb/r/ndb_alter_table_online.result 2012-03-19 09:44:55 +0000
@@ -641,3 +641,11 @@ alter online table t1 add column c502 va
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 14000. You have to change some columns to TEXT or BLOBs
delete from t1;
drop table t1;
+create table t1(a int(10) unsigned not null auto_increment,
+b varchar(20) default 'x',
+c varchar(20) default null,
+primary key (a) ) engine=ndbcluster;
+alter online table t1 add e varchar(20) default 'x' column_format dynamic;
+ERROR 42000: This version of MySQL doesn't yet support 'alter online table t1 add e varchar(20) default 'x' column_format dynamic'
+alter online table t1 add e varchar(20) default null column_format dynamic;
+drop table t1;
=== modified file 'mysql-test/suite/ndb/t/ndb_alter_table_online.test'
--- a/mysql-test/suite/ndb/t/ndb_alter_table_online.test 2011-06-17 10:15:34 +0000
+++ b/mysql-test/suite/ndb/t/ndb_alter_table_online.test 2012-03-19 09:44:55 +0000
@@ -688,3 +688,17 @@ alter online table t1 add column c502 va
delete from t1;
drop table t1;
+
+#
+# Bug #13830980 MYSQL COMPLAINS OF NOT SUPPORTING ALTER ONLINE EVEN WHEN VALID OPTIONS ARE USED
+#
+
+create table t1(a int(10) unsigned not null auto_increment,
+ b varchar(20) default 'x',
+ c varchar(20) default null,
+ primary key (a) ) engine=ndbcluster;
+
+--error ER_NOT_SUPPORTED_YET
+alter online table t1 add e varchar(20) default 'x' column_format dynamic;
+alter online table t1 add e varchar(20) default null column_format dynamic;
+drop table t1;
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2012-03-12 15:16:41 +0000
+++ b/sql/ha_ndbcluster.cc 2012-03-19 09:44:55 +0000
@@ -14946,6 +14946,7 @@ HA_ALTER_FLAGS supported_alter_operation
HA_ADD_UNIQUE_INDEX |
HA_DROP_UNIQUE_INDEX |
HA_ADD_COLUMN |
+ HA_COLUMN_DEFAULT_VALUE |
HA_COLUMN_STORAGE |
HA_COLUMN_FORMAT |
HA_ADD_PARTITION |
@@ -14999,6 +15000,13 @@ int ha_ndbcluster::check_if_supported_al
}
}
+ if (alter_flags->is_set(HA_COLUMN_DEFAULT_VALUE) &&
+ !alter_flags->is_set(HA_ADD_COLUMN))
+ {
+ DBUG_PRINT("info", ("Altering default value is not supported"));
+ DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+ }
+
if ((*alter_flags & not_supported).is_set())
{
#ifndef DBUG_OFF
@@ -15028,13 +15036,14 @@ int ha_ndbcluster::check_if_supported_al
Check that we are only adding columns
*/
/*
- HA_COLUMN_STORAGE & HA_COLUMN_FORMAT
+ HA_COLUMN_DEFAULT_VALUE & 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_DEFAULT_VALUE);
add_column.set_bit(HA_COLUMN_STORAGE);
add_column.set_bit(HA_COLUMN_FORMAT);
if ((*alter_flags & ~add_column).is_set())
=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2011-11-09 13:10:53 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2012-03-19 09:44:55 +0000
@@ -3448,6 +3448,7 @@ NdbDictInterface::compChangeMask(const N
{
const NdbColumnImpl *col= impl.m_columns[i];
if(!col->m_dynamic || !col->m_nullable ||
+ !col->m_defaultValue.empty() ||
col->m_storageType == NDB_STORAGETYPE_DISK ||
col->m_pk ||
col->m_distributionKey ||
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (Martin.Skold:4891 to 4892)Bug#13830980 | Martin Skold | 19 Mar |