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, 2007-08-08 14:02:52+02:00, mskold@stripped +13 -0
Various bug fixes (bug#30276).
Added support for new syntax:
ALTER TABLE ... [ONLINE [ONLY] | OFFLINE [ONLY]];
CREATE INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
DROP INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
mysql-test/r/ndb_alter_table.result@stripped, 2007-08-08 13:58:57+02:00, mskold@stripped +0 -46
Regenerated result
mysql-test/r/ndb_alter_table_online.result@stripped, 2007-08-08 13:58:57+02:00, mskold@stripped +129 -1
Regenerated result
mysql-test/r/ndb_row_format.result@stripped, 2007-08-08 13:58:57+02:00, mskold@stripped +2 -2
Regenerated result
mysql-test/t/ndb_alter_table.test@stripped, 2007-08-08 13:58:57+02:00, mskold@stripped +0 -69
Moved all on-line tests to ndb_alter_table_online
mysql-test/t/ndb_alter_table_online.test@stripped, 2007-08-08 14:02:42+02:00, mskold@stripped +216 -1
Added new tests
sql/ha_ndbcluster.cc@stripped, 2007-08-08 14:02:42+02:00, mskold@stripped +6 -11
Removed non-backward compatible change (varchars don't become dynamic by default).
Added warning if defining dynamic column for fixed table (bug#30276).
Added flags (HA_COLUMN_STORAGE and HA_COLUMN_FORMAT) to support column_format
and storage specification for on-line add column
(note only in combination with HA_ADD_COLUMN, not for HA_CHANGE_COLUMN).
sql/handler.h@stripped, 2007-08-08 14:02:43+02:00, mskold@stripped +27 -26
Added alter flag HA_CHANGE_COLUMN
sql/lex.h@stripped, 2007-08-08 14:02:43+02:00, mskold@stripped +3 -0
Added support for new syntax:
ALTER TABLE ... [ONLINE [ONLY] | OFFLINE [ONLY]];
CREATE INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
DROP INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
sql/mysql_priv.h@stripped, 2007-08-08 14:02:43+02:00, mskold@stripped +2 -1
Added support for new syntax:
ALTER TABLE ... [ONLINE [ONLY] | OFFLINE [ONLY]];
CREATE INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
DROP INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
sql/sql_lex.h@stripped, 2007-08-08 14:02:43+02:00, mskold@stripped +7 -1
Added support for new syntax:
ALTER TABLE ... [ONLINE [ONLY] | OFFLINE [ONLY]];
CREATE INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
DROP INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
sql/sql_parse.cc@stripped, 2007-08-08 14:02:43+02:00, mskold@stripped +5 -5
Added support for new syntax:
ALTER TABLE ... [ONLINE [ONLY] | OFFLINE [ONLY]];
CREATE INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
DROP INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
sql/sql_table.cc@stripped, 2007-08-08 14:02:44+02:00, mskold@stripped +41 -35
Added new alter flag HA_CHANGE_COLUMN
Added support for new syntax:
ALTER TABLE ... [ONLINE [ONLY] | OFFLINE [ONLY]];
CREATE INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
DROP INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
sql/sql_yacc.yy@stripped, 2007-08-08 14:02:44+02:00, mskold@stripped +41 -8
Added ALTER_COLUMN_DEFAULT to be set for both
ADD and CHANGE COLUMN.
Added support for new syntax:
ALTER TABLE ... [ONLINE [ONLY] | OFFLINE [ONLY]];
CREATE INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
DROP INDEX ... [ONLINE [ONLY] | OFFLINE [ONLY]];
# 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-telco-6.2
--- 1.261/sql/handler.h 2007-08-08 14:03:03 +02:00
+++ 1.262/sql/handler.h 2007-08-08 14:03:03 +02:00
@@ -49,7 +49,7 @@
/* Bits to show what an alter table will do */
#include <sql_bitmap.h>
-#define HA_MAX_ALTER_FLAGS 38
+#define HA_MAX_ALTER_FLAGS 39
typedef Bitmap<HA_MAX_ALTER_FLAGS> HA_ALTER_FLAGS;
#define HA_ADD_INDEX (0)
@@ -65,31 +65,32 @@ typedef Bitmap<HA_MAX_ALTER_FLAGS> HA_AL
#define HA_ALTER_PK_INDEX (10)
#define HA_ADD_COLUMN (11)
#define HA_DROP_COLUMN (12)
-#define HA_ALTER_COLUMN_NAME (13)
-#define HA_ALTER_COLUMN_TYPE (14)
-#define HA_ALTER_COLUMN_ORDER (15)
-#define HA_ALTER_COLUMN_NULLABLE (16)
-#define HA_ALTER_COLUMN_DEFAULT_VALUE (17)
-#define HA_ALTER_COLUMN_STORAGE (18)
-#define HA_ALTER_COLUMN_FORMAT (19)
-#define HA_ADD_FOREIGN_KEY (20)
-#define HA_DROP_FOREIGN_KEY (21)
-#define HA_ALTER_FOREIGN_KEY (22)
-#define HA_ADD_CONSTRAINT (23)
-#define HA_ADD_PARTITION (24)
-#define HA_DROP_PARTITION (25)
-#define HA_ALTER_PARTITION (26)
-#define HA_COALESCE_PARTITION (27)
-#define HA_REORGANIZE_PARTITION (28)
-#define HA_CHANGE_CHARACTER_SET (29)
-#define HA_SET_DEFAULT_CHARACTER_SET (30)
-#define HA_CHANGE_AUTOINCREMENT_VALUE (31)
-#define HA_ALTER_STORAGE (32)
-#define HA_ALTER_TABLESPACE (33)
-#define HA_ALTER_ROW_FORMAT (34)
-#define HA_RENAME_TABLE (35)
-#define HA_ALTER_STORAGE_ENGINE (36)
-#define HA_RECREATE (37)
+#define HA_CHANGE_COLUMN (13)
+#define HA_ALTER_COLUMN_NAME (14)
+#define HA_ALTER_COLUMN_TYPE (15)
+#define HA_ALTER_COLUMN_ORDER (16)
+#define HA_ALTER_COLUMN_NULLABLE (17)
+#define HA_COLUMN_DEFAULT_VALUE (18)
+#define HA_COLUMN_STORAGE (19)
+#define HA_COLUMN_FORMAT (20)
+#define HA_ADD_FOREIGN_KEY (21)
+#define HA_DROP_FOREIGN_KEY (22)
+#define HA_ALTER_FOREIGN_KEY (23)
+#define HA_ADD_CONSTRAINT (24)
+#define HA_ADD_PARTITION (25)
+#define HA_DROP_PARTITION (26)
+#define HA_ALTER_PARTITION (27)
+#define HA_COALESCE_PARTITION (28)
+#define HA_REORGANIZE_PARTITION (29)
+#define HA_CHANGE_CHARACTER_SET (30)
+#define HA_SET_DEFAULT_CHARACTER_SET (31)
+#define HA_CHANGE_AUTOINCREMENT_VALUE (32)
+#define HA_ALTER_STORAGE (33)
+#define HA_ALTER_TABLESPACE (34)
+#define HA_ALTER_ROW_FORMAT (35)
+#define HA_RENAME_TABLE (36)
+#define HA_ALTER_STORAGE_ENGINE (37)
+#define HA_RECREATE (38)
/* Remember to increase HA_MAX_ALTER_FLAGS when adding more flags! */
/* Return values for check_if_supported_alter */
--- 1.175/sql/lex.h 2007-08-08 14:03:03 +02:00
+++ 1.176/sql/lex.h 2007-08-08 14:03:03 +02:00
@@ -363,10 +363,13 @@ static SYMBOL symbols[] = {
{ "NULL", SYM(NULL_SYM)},
{ "NUMERIC", SYM(NUMERIC_SYM)},
{ "NVARCHAR", SYM(NVARCHAR_SYM)},
+ { "OFFLINE", SYM(OFFLINE_SYM)},
{ "OFFSET", SYM(OFFSET_SYM)},
{ "OLD_PASSWORD", SYM(OLD_PASSWORD)},
{ "ON", SYM(ON)},
{ "ONE", SYM(ONE_SYM)},
+ { "ONLINE", SYM(ONLINE_SYM)},
+ { "ONLY", SYM(ONLY_SYM)},
{ "ONE_SHOT", SYM(ONE_SHOT_SYM)},
{ "OPEN", SYM(OPEN_SYM)},
{ "OPTIMIZE", SYM(OPTIMIZE)},
--- 1.509/sql/mysql_priv.h 2007-08-08 14:03:03 +02:00
+++ 1.510/sql/mysql_priv.h 2007-08-08 14:03:03 +02:00
@@ -997,7 +997,8 @@ bool mysql_create_like_table(THD *thd, T
bool mysql_rename_table(handlerton *base, const char *old_db,
const char * old_name, const char *new_db,
const char * new_name, uint flags);
-bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys);
+bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys,
+ ALTER_INFO *alter_info);
bool mysql_drop_index(THD *thd, TABLE_LIST *table_list,
ALTER_INFO *alter_info);
bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
--- 1.278/sql/sql_lex.h 2007-08-08 14:03:03 +02:00
+++ 1.279/sql/sql_lex.h 2007-08-08 14:03:03 +02:00
@@ -813,7 +813,7 @@ inline bool st_select_lex_unit::is_union
#define ALTER_RENAME (1L << 8)
#define ALTER_ORDER (1L << 9)
#define ALTER_OPTIONS (1L << 10)
-#define ALTER_CHANGE_COLUMN_DEFAULT (1L << 11)
+#define ALTER_COLUMN_DEFAULT (1L << 11)
#define ALTER_KEYS_ONOFF (1L << 12)
#define ALTER_STORAGE (1L << 13)
#define ALTER_ROW_FORMAT (1L << 14)
@@ -835,6 +835,10 @@ inline bool st_select_lex_unit::is_union
#define ALTER_REMOVE_PARTITIONING (1L << 30)
#define ALTER_FOREIGN_KEY (1L << 31)
+enum enum_build_method { BUILD_METHOD_DEFAULT,
+ BUILD_METHOD_ONLINE,
+ BUILD_METHOD_OFFLINE };
+
typedef struct st_alter_info
{
List<Alter_drop> drop_list;
@@ -844,6 +848,7 @@ typedef struct st_alter_info
enum tablespace_op_type tablespace_op;
List<char> partition_names;
uint no_parts;
+ enum enum_build_method build_method;
st_alter_info(){clear();}
void clear()
@@ -852,6 +857,7 @@ typedef struct st_alter_info
tablespace_op= NO_TABLESPACE_OP;
no_parts= 0;
partition_names.empty();
+ build_method= BUILD_METHOD_DEFAULT;
}
void reset(){drop_list.empty();alter_list.empty();clear();}
} ALTER_INFO;
--- 1.669/sql/sql_parse.cc 2007-08-08 14:03:04 +02:00
+++ 1.670/sql/sql_parse.cc 2007-08-08 14:03:04 +02:00
@@ -2266,7 +2266,7 @@ end_with_restore_list:
thd->enable_slow_log= opt_log_slow_admin_statements;
if (end_active_trans(thd))
goto error;
- res= mysql_create_index(thd, first_table, lex->key_list);
+ res= mysql_create_index(thd, first_table, lex->key_list, &lex->alter_info);
break;
#ifdef HAVE_REPLICATION
@@ -6553,11 +6553,11 @@ Item * all_any_subquery_creator(Item *le
One should normally create all indexes with CREATE TABLE or ALTER TABLE.
*/
-bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
+bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys,
+ ALTER_INFO *alter_info)
{
List<create_field> fields;
- ALTER_INFO alter_info;
- alter_info.flags= ALTER_ADD_INDEX;
+ alter_info->flags= ALTER_ADD_INDEX;
HA_CREATE_INFO create_info;
DBUG_ENTER("mysql_create_index");
bzero((char*) &create_info,sizeof(create_info));
@@ -6567,7 +6567,7 @@ bool mysql_create_index(THD *thd, TABLE_
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->table_name,
&create_info, table_list,
fields, keys, 0, (ORDER*)0,
- 0, &alter_info, 1));
+ 0, alter_info, 1));
}
--- 1.421/sql/sql_table.cc 2007-08-08 14:03:04 +02:00
+++ 1.422/sql/sql_table.cc 2007-08-08 14:03:04 +02:00
@@ -5044,14 +5044,13 @@ void setup_alter_table_flags(ALTER_INFO*
if (ALTER_RENAME & flags)
*alter_flags|= HA_RENAME_TABLE;
if (ALTER_CHANGE_COLUMN & flags)
- {
- if (ALTER_CHANGE_COLUMN_DEFAULT & flags)
- *alter_flags|= HA_ALTER_COLUMN_DEFAULT_VALUE;
- if (ALTER_COLUMN_STORAGE & flags)
- *alter_flags|= HA_ALTER_COLUMN_STORAGE;
- if (ALTER_COLUMN_FORMAT & flags)
- *alter_flags|= HA_ALTER_COLUMN_FORMAT;
- }
+ *alter_flags|= HA_CHANGE_COLUMN;
+ if (ALTER_COLUMN_DEFAULT & flags)
+ *alter_flags|= HA_COLUMN_DEFAULT_VALUE;
+ if (ALTER_COLUMN_STORAGE & flags)
+ *alter_flags|= HA_COLUMN_STORAGE;
+ if (ALTER_COLUMN_FORMAT & flags)
+ *alter_flags|= HA_COLUMN_FORMAT;
if (ALTER_COLUMN_ORDER & flags)
*alter_flags|= HA_ALTER_COLUMN_ORDER;
if (ALTER_STORAGE & flags)
@@ -5753,7 +5752,7 @@ bool mysql_alter_table(THD *thd,char *ne
HA_CREATE_INFO *create_info;
frm_type_enum frm_type;
HA_ALTER_FLAGS alter_table_flags;
- uint table_changes= IS_EQUAL_YES, need_copy_table= 0;
+ uint table_changes= IS_EQUAL_YES;
bool no_table_reopen= FALSE, varchar= FALSE;
#ifdef WITH_PARTITION_STORAGE_ENGINE
uint fast_alter_partition= 0;
@@ -5761,7 +5760,7 @@ bool mysql_alter_table(THD *thd,char *ne
#endif
List<create_field> prepared_create_list, prepared_create_list2;
List<Key> prepared_key_list, prepared_key_list2;;
- bool need_lock= TRUE;
+ bool need_copy_table= TRUE, need_lock= TRUE;
uint db_options= 0;
bool committed= 0;
HA_ALTER_INFO alter_table_info;
@@ -6480,7 +6479,7 @@ view_err:
|| partition_changed
#endif
)
- need_copy_table= 1;
+ need_copy_table= TRUE;
else
{
/* Try to optimize ALTER TABLE. Allocate result buffers. */
@@ -6523,31 +6522,38 @@ view_err:
If no table rename,
check if table can be altered on-line
*/
- if (!(altered_table= create_altered_table(thd,
- table,
- new_db,
- create_info,
- prepared_create_list2,
- prepared_key_list2,
- !strcmp(db, new_db))))
- goto err;
- switch(table->file->check_if_supported_alter(altered_table,
- create_info,
- &alter_table_flags,
- table_changes)) {
- case(HA_ALTER_NOT_SUPPORTED):
- need_copy_table= TRUE;
- break;
- case(HA_ALTER_SUPPORTED_WAIT_LOCK):
- need_lock= TRUE;
- case(HA_ALTER_SUPPORTED_NO_LOCK):
- need_copy_table= FALSE;
- break;
- case(HA_ALTER_ERROR):
- default:
- goto err;
+ if (alter_info->build_method != BUILD_METHOD_OFFLINE)
+ {
+ if (!(altered_table= create_altered_table(thd,
+ table,
+ new_db,
+ create_info,
+ prepared_create_list2,
+ prepared_key_list2,
+ !strcmp(db, new_db))))
+ goto err;
+ switch(table->file->check_if_supported_alter(altered_table,
+ create_info,
+ &alter_table_flags,
+ table_changes)) {
+ case(HA_ALTER_NOT_SUPPORTED):
+ if (alter_info->build_method == BUILD_METHOD_ONLINE)
+ {
+ my_error(ER_NOT_SUPPORTED_YET, MYF(0), thd->query);
+ goto err;
+ }
+ need_copy_table= TRUE;
+ break;
+ case(HA_ALTER_SUPPORTED_WAIT_LOCK):
+ need_lock= TRUE;
+ case(HA_ALTER_SUPPORTED_NO_LOCK):
+ need_copy_table= FALSE;
+ break;
+ case(HA_ALTER_ERROR):
+ default:
+ goto err;
+ }
}
-
#ifndef DBUG_OFF
{
char dbug_string[HA_MAX_ALTER_FLAGS+1];
--- 1.571/sql/sql_yacc.yy 2007-08-08 14:03:04 +02:00
+++ 1.572/sql/sql_yacc.yy 2007-08-08 14:03:04 +02:00
@@ -492,10 +492,10 @@ bool my_yyoverflow(short **a, YYSTYPE **
%pure_parser /* We have threads */
/*
- Currently there is 287 shift/reduce conflict. We should not introduce
+ Currently there is 292 shift/reduce conflict. We should not introduce
new conflicts any more.
*/
-%expect 286
+%expect 292
/*
Comments for TOKENS.
@@ -840,11 +840,14 @@ bool my_yyoverflow(short **a, YYSTYPE **
%token NUM
%token NUMERIC_SYM /* SQL-2003-R */
%token NVARCHAR_SYM
+%token OFFLINE_SYM
%token OFFSET_SYM
%token OLD_PASSWORD
%token ON /* SQL-2003-R */
%token ONE_SHOT_SYM
%token ONE_SYM
+%token ONLINE_SYM
+%token ONLY_SYM
%token OPEN_SYM /* SQL-2003-R */
%token OPTIMIZE
%token OPTIONS_SYM
@@ -1600,7 +1603,7 @@ create:
}
}
| CREATE opt_unique_or_fulltext INDEX_SYM ident key_alg ON
- table_ident
+ table_ident build_method
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_CREATE_INDEX;
@@ -4810,7 +4813,11 @@ attribute:
Lex->alter_info.flags|= ALTER_COLUMN_FORMAT;
}
| not NULL_SYM { Lex->type|= NOT_NULL_FLAG; }
- | DEFAULT now_or_signed_literal { Lex->default_value=$2; }
+ | DEFAULT now_or_signed_literal
+ {
+ Lex->default_value=$2;
+ Lex->alter_info.flags|= ALTER_COLUMN_DEFAULT;
+ }
| ON UPDATE_SYM NOW_SYM optional_braces
{ Lex->on_update_value= new Item_func_now_local(); }
| AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
@@ -5172,7 +5179,7 @@ alter:
lex->no_write_to_binlog= 0;
lex->create_info.default_storage_media= HA_SM_DEFAULT;
}
- alter_commands
+ alter_commands build_method
{}
| ALTER DATABASE ident_or_empty
{
@@ -5426,6 +5433,29 @@ alter_commands:
| reorg_partition_rule
;
+build_method:
+ /* empty */
+ {
+ Lex->alter_info.build_method= BUILD_METHOD_DEFAULT;
+ }
+ | ONLINE_SYM ONLY_SYM
+ {
+ Lex->alter_info.build_method= BUILD_METHOD_ONLINE;
+ }
+ | ONLINE_SYM
+ {
+ Lex->alter_info.build_method= BUILD_METHOD_ONLINE;
+ }
+ | OFFLINE_SYM ONLY_SYM
+ {
+ Lex->alter_info.build_method= BUILD_METHOD_OFFLINE;
+ }
+ | OFFLINE_SYM
+ {
+ Lex->alter_info.build_method= BUILD_METHOD_OFFLINE;
+ }
+ ;
+
remove_partitioning:
REMOVE_SYM PARTITIONING_SYM
{
@@ -5619,14 +5649,14 @@ alter_list_item:
{
LEX *lex=Lex;
lex->alter_info.alter_list.push_back(new Alter_column($3.str,$6));
- lex->alter_info.flags|= ALTER_CHANGE_COLUMN_DEFAULT;
+ lex->alter_info.flags|= ALTER_COLUMN_DEFAULT;
}
| ALTER opt_column field_ident DROP DEFAULT
{
LEX *lex=Lex;
lex->alter_info.alter_list.push_back(new Alter_column($3.str,
(Item*) 0));
- lex->alter_info.flags|= ALTER_CHANGE_COLUMN_DEFAULT;
+ lex->alter_info.flags|= ALTER_COLUMN_DEFAULT;
}
| RENAME opt_to table_ident
{
@@ -8210,7 +8240,7 @@ drop:
lex->drop_temporary= $2;
lex->drop_if_exists= $4;
}
- | DROP INDEX_SYM ident ON table_ident {}
+ | DROP INDEX_SYM ident ON table_ident build_method {}
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_DROP_INDEX;
@@ -10059,10 +10089,13 @@ keyword_sp:
| NODEGROUP_SYM {}
| NONE_SYM {}
| NVARCHAR_SYM {}
+ | OFFLINE_SYM {}
| OFFSET_SYM {}
| OLD_PASSWORD {}
| ONE_SHOT_SYM {}
| ONE_SYM {}
+ | ONLINE_SYM {}
+ | ONLY_SYM {}
| PACK_KEYS_SYM {}
| PARTIAL {}
| PARTITIONING_SYM {}
--- 1.45/mysql-test/r/ndb_alter_table.result 2007-08-08 14:03:04 +02:00
+++ 1.46/mysql-test/r/ndb_alter_table.result 2007-08-08 14:03:04 +02:00
@@ -286,52 +286,6 @@ unique key tx1 (c002, c003, c004, c005))
create index tx2
on t1 (c010, c011, c012, c013);
drop table t1;
-CREATE TABLE t1 (
-auto int(5) unsigned NOT NULL auto_increment,
-string char(10),
-vstring varchar(10),
-bin binary(2),
-vbin varbinary(7),
-tiny tinyint(4) DEFAULT '0' NOT NULL ,
-short smallint(6) DEFAULT '1' NOT NULL ,
-medium mediumint(8) DEFAULT '0' NOT NULL,
-long_int int(11) DEFAULT '0' NOT NULL,
-longlong bigint(13) DEFAULT '0' NOT NULL,
-real_float float(13,1) DEFAULT 0.0 NOT NULL,
-real_double double(16,4),
-real_decimal decimal(16,4),
-utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
-ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
-umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
-ulong int(11) unsigned DEFAULT '0' NOT NULL,
-ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
-bits bit(3),
-options enum('zero','one','two','three','four') not null,
-flags set('zero','one','two','three','four') not null,
-date_field date,
-year_field year,
-time_field time,
-date_time datetime,
-time_stamp timestamp,
-PRIMARY KEY (auto)
-) engine=ndb;
-CREATE TEMPORARY TABLE ndb_show_tables (id INT, type VARCHAR(20), state VARCHAR(20), logging VARCHAR(20), _database VARCHAR(255), _schema VARCHAR(20), name VARCHAR(255));
-LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
-set @t1_id = (select id from ndb_show_tables where name = 't1');
-truncate ndb_show_tables;
-alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
-LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
-select 'no_copy' from ndb_show_tables where id = @t1_id and name = 't1';
-no_copy
-set @t1_id = (select id from ndb_show_tables where name = 't1');
-truncate ndb_show_tables;
-create index i1 on t1(medium);
-alter table t1 add index i2(new_tiny);
-drop index i1 on t1;
-LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
-select 'no_copy' from ndb_show_tables where id = @t1_id and name = 't1';
-no_copy
-DROP TABLE t1, ndb_show_tables;
create table t1 (a int primary key auto_increment, b int) engine=ndb;
insert into t1 (b) values (101),(102),(103);
select * from t1 where a = 3;
--- 1.41/mysql-test/t/ndb_alter_table.test 2007-08-08 14:03:04 +02:00
+++ 1.42/mysql-test/t/ndb_alter_table.test 2007-08-08 14:03:04 +02:00
@@ -326,75 +326,6 @@ drop table t1;
# End of 4.1 tests
-# On-line alter table
-
-
-CREATE TABLE t1 (
- auto int(5) unsigned NOT NULL auto_increment,
- string char(10),
- vstring varchar(10),
- bin binary(2),
- vbin varbinary(7),
- tiny tinyint(4) DEFAULT '0' NOT NULL ,
- short smallint(6) DEFAULT '1' NOT NULL ,
- medium mediumint(8) DEFAULT '0' NOT NULL,
- long_int int(11) DEFAULT '0' NOT NULL,
- longlong bigint(13) DEFAULT '0' NOT NULL,
- real_float float(13,1) DEFAULT 0.0 NOT NULL,
- real_double double(16,4),
- real_decimal decimal(16,4),
- utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
- ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
- umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
- ulong int(11) unsigned DEFAULT '0' NOT NULL,
- ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
- bits bit(3),
- options enum('zero','one','two','three','four') not null,
- flags set('zero','one','two','three','four') not null,
- date_field date,
- year_field year,
- time_field time,
- date_time datetime,
- time_stamp timestamp,
- PRIMARY KEY (auto)
-) engine=ndb;
-
-CREATE TEMPORARY TABLE ndb_show_tables (id INT, type VARCHAR(20), state VARCHAR(20), logging VARCHAR(20), _database VARCHAR(255), _schema VARCHAR(20), name VARCHAR(255));
-
---disable_warnings
---exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
-LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
---enable_warnings
-
-# Ndb doesn't support renaming attributes on-line
-set @t1_id = (select id from ndb_show_tables where name = 't1');
-truncate ndb_show_tables;
-
-alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
---disable_warnings
---exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
-LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
---enable_warnings
-
-select 'no_copy' from ndb_show_tables where id = @t1_id and name = 't1';
-
-set @t1_id = (select id from ndb_show_tables where name = 't1');
-truncate ndb_show_tables;
-
-create index i1 on t1(medium);
-alter table t1 add index i2(new_tiny);
-drop index i1 on t1;
-
---disable_warnings
---exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
-LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
---exec rm $MYSQLTEST_VARDIR/master-data/test/tmp.dat || true
---enable_warnings
-
-select 'no_copy' from ndb_show_tables where id = @t1_id and name = 't1';
-
-DROP TABLE t1, ndb_show_tables;
-
# simple test that auto incr is not lost at rename or alter
create table t1 (a int primary key auto_increment, b int) engine=ndb;
insert into t1 (b) values (101),(102),(103);
--- 1.487/sql/ha_ndbcluster.cc 2007-08-08 14:03:04 +02:00
+++ 1.488/sql/ha_ndbcluster.cc 2007-08-08 14:03:04 +02:00
@@ -5583,14 +5583,7 @@ static int create_ndb_column(THD *thd,
case(COLUMN_FORMAT_TYPE_DEFAULT):
default:
if (create_info->row_type == ROW_TYPE_DEFAULT)
- {
- if (default_format == COLUMN_FORMAT_TYPE_DEFAULT)
- {
- dynamic= field_type_forces_var_part(field->type());
- }
- else
- dynamic= default_format;
- }
+ dynamic= default_format;
else
dynamic= (create_info->row_type == ROW_TYPE_DYNAMIC);
break;
@@ -5618,12 +5611,12 @@ static int create_ndb_column(THD *thd,
switch (create_info->row_type) {
case ROW_TYPE_FIXED:
- if (thd && field_type_forces_var_part(field->type()))
+ if (thd && (dynamic || field_type_forces_var_part(field->type())))
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"Row format FIXED incompatible with "
- "variable sized attribute %s",
+ "dynamic attribute %s",
field->field_name);
}
break;
@@ -10644,7 +10637,9 @@ HA_ALTER_FLAGS supported_alter_operation
HA_DROP_INDEX |
HA_ADD_UNIQUE_INDEX |
HA_DROP_UNIQUE_INDEX |
- HA_ADD_COLUMN;
+ HA_ADD_COLUMN |
+ HA_COLUMN_STORAGE |
+ HA_COLUMN_FORMAT;
}
int ha_ndbcluster::check_if_supported_alter(TABLE *altered_table,
--- 1.3/mysql-test/r/ndb_alter_table_online.result 2007-08-08 14:03:04 +02:00
+++ 1.4/mysql-test/r/ndb_alter_table_online.result 2007-08-08 14:03:04 +02:00
@@ -1,7 +1,16 @@
DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ENGINE NDB;
+CREATE TEMPORARY TABLE ndb_show_tables (id INT, type VARCHAR(20), state VARCHAR(20), logging VARCHAR(20), _database VARCHAR(255), _schema VARCHAR(20), name VARCHAR(255));
+CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
INSERT INTO t1 values (1,1);
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
ALTER TABLE t1 ADD c CHAR(19);
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+name
+'t1'
+truncate ndb_show_tables;
INSERT INTO t1 values (2,1,"a");
SELECT * FROM t1 ORDER BY a;
a b c
@@ -10,9 +19,17 @@ a b c
DROP TABLE t1;
CREATE TABLE t1 (a INT UNSIGNED KEY, b VARCHAR(19)) ENGINE NDB;
INSERT INTO t1 values (1,"a");
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
ALTER TABLE t1 ADD c INT;
Warnings:
Warning 1466 Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+name
+'t1'
+truncate ndb_show_tables;
INSERT INTO t1 values (2,"a",1);
SELECT * FROM t1 ORDER BY a;
a b c
@@ -21,12 +38,123 @@ a b c
DROP TABLE t1;
CREATE TABLE t1 (a INT UNSIGNED KEY, b INT COLUMN_FORMAT DYNAMIC) ENGINE NDB;
INSERT INTO t1 values (1,1);
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
ALTER TABLE t1 ADD c INT;
Warnings:
Warning 1466 Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+select id,name from ndb_show_tables where id = @t1_id and name like '%t1%';
+id name
+5 't1'
+truncate ndb_show_tables;
INSERT INTO t1 values (2,1,1);
SELECT * FROM t1 ORDER BY a;
a b c
1 1 NULL
2 1 1
DROP TABLE t1;
+CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
+INSERT INTO t1 values (1,1);
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+ALTER TABLE t1 ADD c CHAR(19) DEFAULT 17 ONLINE;
+ERROR 42000: This version of MySQL doesn't yet support 'ALTER TABLE t1 ADD c CHAR(19) DEFAULT 17 ONLINE'
+ALTER TABLE t1 ADD c CHAR(19) DEFAULT 17;
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+name
+truncate ndb_show_tables;
+INSERT INTO t1 values (2,1,"a");
+SELECT * FROM t1 ORDER BY a;
+a b c
+1 1 17
+2 1 a
+DROP TABLE t1;
+CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
+INSERT INTO t1 values (1,1);
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+ALTER TABLE t1 ADD c CHAR(19) NOT NULL ONLINE;
+ERROR 42000: This version of MySQL doesn't yet support 'ALTER TABLE t1 ADD c CHAR(19) NOT NULL ONLINE'
+ALTER TABLE t1 ADD c CHAR(19) NOT NULL;
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+name
+truncate ndb_show_tables;
+INSERT INTO t1 values (2,1,"a");
+SELECT * FROM t1 ORDER BY a;
+a b c
+1 1
+2 1 a
+DROP TABLE t1;
+CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
+INSERT INTO t1 values (1,1);
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+ALTER TABLE t1 ADD c CHAR(19) COLUMN_FORMAT FIXED ONLINE;
+ERROR 42000: This version of MySQL doesn't yet support 'ALTER TABLE t1 ADD c CHAR(19) COLUMN_FORMAT FIXED ONLINE'
+ALTER TABLE t1 ADD c CHAR(19) COLUMN_FORMAT FIXED;
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+name
+truncate ndb_show_tables;
+INSERT INTO t1 values (2,1,"a");
+SELECT * FROM t1 ORDER BY a;
+a b c
+1 1 NULL
+2 1 a
+DROP TABLE t1;
+CREATE TABLE t1 (
+auto int(5) unsigned NOT NULL auto_increment,
+string char(10),
+vstring varchar(10),
+bin binary(2),
+vbin varbinary(7),
+tiny tinyint(4) DEFAULT '0' NOT NULL ,
+short smallint(6) DEFAULT '1' NOT NULL ,
+medium mediumint(8) DEFAULT '0' NOT NULL,
+long_int int(11) DEFAULT '0' NOT NULL,
+longlong bigint(13) DEFAULT '0' NOT NULL,
+real_float float(13,1) DEFAULT 0.0 NOT NULL,
+real_double double(16,4),
+real_decimal decimal(16,4),
+utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
+ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
+umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
+ulong int(11) unsigned DEFAULT '0' NOT NULL,
+ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
+bits bit(3),
+options enum('zero','one','two','three','four') not null,
+flags set('zero','one','two','three','four') not null,
+date_field date,
+year_field year,
+time_field time,
+date_time datetime,
+time_stamp timestamp,
+PRIMARY KEY (auto)
+) engine=ndb;
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL ONLINE;
+ERROR 42000: This version of MySQL doesn't yet support 'alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL ONLINE'
+alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+name
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+create index i1 on t1(medium);
+alter table t1 add index i2(new_tiny);
+drop index i1 on t1;
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+name
+'t1'
+DROP TABLE t1;
+DROP TABLE ndb_show_tables;
--- 1.5/mysql-test/r/ndb_row_format.result 2007-08-08 14:03:04 +02:00
+++ 1.6/mysql-test/r/ndb_row_format.result 2007-08-08 14:03:04 +02:00
@@ -6,10 +6,10 @@ b VARCHAR(10) )
ROW_FORMAT=FIXED
ENGINE=NDB;
Warnings:
-Warning 1466 Row format FIXED incompatible with variable sized attribute b
+Warning 1466 Row format FIXED incompatible with dynamic attribute b
SHOW WARNINGS;
Level Code Message
-Warning 1466 Row format FIXED incompatible with variable sized attribute b
+Warning 1466 Row format FIXED incompatible with dynamic attribute b
ForceVarPart: 0
INSERT INTO t1 values(0,''),(2,"**"),(4,"****"),(6,"******"),(8,"********"),(10,"**********"),(12,"************");
Warnings:
--- 1.1/mysql-test/t/ndb_alter_table_online.test 2007-08-08 14:03:04 +02:00
+++ 1.2/mysql-test/t/ndb_alter_table_online.test 2007-08-08 14:03:04 +02:00
@@ -7,23 +7,238 @@ DROP TABLE IF EXISTS t1;
#
# basic online alter test
#
-CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ENGINE NDB;
+
+CREATE TEMPORARY TABLE ndb_show_tables (id INT, type VARCHAR(20), state VARCHAR(20), logging VARCHAR(20), _database VARCHAR(255), _schema VARCHAR(20), name VARCHAR(255));
+
+CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
INSERT INTO t1 values (1,1);
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+
ALTER TABLE t1 ADD c CHAR(19);
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+
+truncate ndb_show_tables;
+
INSERT INTO t1 values (2,1,"a");
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
CREATE TABLE t1 (a INT UNSIGNED KEY, b VARCHAR(19)) ENGINE NDB;
INSERT INTO t1 values (1,"a");
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+
ALTER TABLE t1 ADD c INT;
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+
+truncate ndb_show_tables;
+
INSERT INTO t1 values (2,"a",1);
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
CREATE TABLE t1 (a INT UNSIGNED KEY, b INT COLUMN_FORMAT DYNAMIC) ENGINE NDB;
INSERT INTO t1 values (1,1);
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+
ALTER TABLE t1 ADD c INT;
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+select id,name from ndb_show_tables where id = @t1_id and name like '%t1%';
+
+truncate ndb_show_tables;
+
INSERT INTO t1 values (2,1,1);
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
+
+# The following ALTER operations are not supported on-line
+
+CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
+INSERT INTO t1 values (1,1);
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+
+--error ER_NOT_SUPPORTED_YET
+ALTER TABLE t1 ADD c CHAR(19) DEFAULT 17 ONLINE;
+ALTER TABLE t1 ADD c CHAR(19) DEFAULT 17;
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+
+truncate ndb_show_tables;
+
+INSERT INTO t1 values (2,1,"a");
+SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
+INSERT INTO t1 values (1,1);
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+
+--error ER_NOT_SUPPORTED_YET
+ALTER TABLE t1 ADD c CHAR(19) NOT NULL ONLINE;
+ALTER TABLE t1 ADD c CHAR(19) NOT NULL;
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+
+truncate ndb_show_tables;
+
+INSERT INTO t1 values (2,1,"a");
+SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB;
+INSERT INTO t1 values (1,1);
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+
+--error ER_NOT_SUPPORTED_YET
+ALTER TABLE t1 ADD c CHAR(19) COLUMN_FORMAT FIXED ONLINE;
+ALTER TABLE t1 ADD c CHAR(19) COLUMN_FORMAT FIXED;
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+
+truncate ndb_show_tables;
+
+INSERT INTO t1 values (2,1,"a");
+SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ auto int(5) unsigned NOT NULL auto_increment,
+ string char(10),
+ vstring varchar(10),
+ bin binary(2),
+ vbin varbinary(7),
+ tiny tinyint(4) DEFAULT '0' NOT NULL ,
+ short smallint(6) DEFAULT '1' NOT NULL ,
+ medium mediumint(8) DEFAULT '0' NOT NULL,
+ long_int int(11) DEFAULT '0' NOT NULL,
+ longlong bigint(13) DEFAULT '0' NOT NULL,
+ real_float float(13,1) DEFAULT 0.0 NOT NULL,
+ real_double double(16,4),
+ real_decimal decimal(16,4),
+ utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
+ ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
+ umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
+ ulong int(11) unsigned DEFAULT '0' NOT NULL,
+ ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
+ bits bit(3),
+ options enum('zero','one','two','three','four') not null,
+ flags set('zero','one','two','three','four') not null,
+ date_field date,
+ year_field year,
+ time_field time,
+ date_time datetime,
+ time_stamp timestamp,
+ PRIMARY KEY (auto)
+) engine=ndb;
+
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+# Ndb doesn't support renaming attributes on-line
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+
+--error ER_NOT_SUPPORTED_YET
+alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL ONLINE;
+alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+
+set @t1_id = (select id from ndb_show_tables where name like '%t1%' and type like '%UserTable%');
+truncate ndb_show_tables;
+
+create index i1 on t1(medium);
+alter table t1 add index i2(new_tiny);
+drop index i1 on t1;
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--exec rm $MYSQLTEST_VARDIR/master-data/test/tmp.dat || true
+--enable_warnings
+
+select name from ndb_show_tables where id = @t1_id and name like '%t1%' and type like '%UserTable%';
+
+DROP TABLE t1;
+
+DROP TABLE ndb_show_tables;
| Thread |
|---|
| • bk commit into 5.1 tree (mskold:1.2607) BUG#30276 | Martin Skold | 8 Aug |