mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Added verification test of on-line (non-copying) alter table
This commit is contained in:
@@ -286,3 +286,45 @@ unique key tx1 (c002, c003, c004, c005)) engine=ndb;
|
|||||||
create index tx2
|
create index tx2
|
||||||
on t1 (c010, c011, c012, c013);
|
on t1 (c010, c011, c012, c013);
|
||||||
drop table t1;
|
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 like '%t1%');
|
||||||
|
truncate ndb_show_tables;
|
||||||
|
alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
|
||||||
|
create index i1 on t1(medium);
|
||||||
|
alter table t1 add index i2(long_int);
|
||||||
|
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 like '%t1%';
|
||||||
|
no_copy
|
||||||
|
no_copy
|
||||||
|
DROP TABLE t1, ndb_show_tables;
|
||||||
|
@@ -327,3 +327,59 @@ drop table t1;
|
|||||||
|
|
||||||
# End of 4.1 tests
|
# 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
|
||||||
|
|
||||||
|
set @t1_id = (select id from ndb_show_tables where name like '%t1%');
|
||||||
|
truncate ndb_show_tables;
|
||||||
|
|
||||||
|
alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
|
||||||
|
create index i1 on t1(medium);
|
||||||
|
alter table t1 add index i2(long_int);
|
||||||
|
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;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
|
||||||
|
|
||||||
|
DROP TABLE t1, ndb_show_tables;
|
||||||
|
@@ -188,6 +188,8 @@ list(const char * tabname,
|
|||||||
ndbout_c("%-5d %-20s %-8s %-7s %s", elt.id, type, state, store, elt.name);
|
ndbout_c("%-5d %-20s %-8s %-7s %s", elt.id, type, state, store, elt.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (_parsable)
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
NDB_STD_OPTS_VARS;
|
NDB_STD_OPTS_VARS;
|
||||||
|
Reference in New Issue
Block a user