128 lines
3.2 KiB
Plaintext
128 lines
3.2 KiB
Plaintext
DROP TABLE IF EXISTS t1;
|
|
CREATE DATABASE IF NOT EXISTS mysqlslap;
|
|
CREATE TEMPORARY TABLE IF NOT EXISTS ndb_show_tables_results (
|
|
id INT,
|
|
type VARCHAR(20),
|
|
state VARCHAR(20),
|
|
logging VARCHAR(20),
|
|
_database VARCHAR(255),
|
|
_schema VARCHAR(20),
|
|
name VARCHAR(255)
|
|
);
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
~ basic online alter test during load
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
create table t1 (pk int key, a int) engine ndb;
|
|
insert into t1 values (1,0);
|
|
|
|
ndb_show_tables completed.....
|
|
|
|
set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%');
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
~ Starting mysqlslap
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
~ Alter table t1 add column b
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
ALTER TABLE t1 algorithm=inplace, ADD b INT;
|
|
Warnings:
|
|
Warning 1478 Converted FIXED field 'b' to DYNAMIC to enable online ADD COLUMN
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
~ Check table t1 ID has not changed
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
ndb_show_tables completed.....
|
|
|
|
select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
|
|
name
|
|
't1'
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
~ Starting mysqlslap using column b
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
update t1 set b = 0 where pk = 1;
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
~ Alter table t1 add column c
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
ALTER TABLE t1 algorithm=inplace, ADD c INT;
|
|
Warnings:
|
|
Warning 1478 Converted FIXED field 'c' to DYNAMIC to enable online ADD COLUMN
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
~ Check table t1 ID has not changed
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
ndb_show_tables completed.....
|
|
|
|
select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
|
|
name
|
|
't1'
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
~ Starting mysqlslap using column c
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
update t1 set c = 0 where pk = 1;
|
|
select * from t1;
|
|
pk a b c
|
|
1 2000 2000 2000
|
|
|
|
BUG#17400320 algorithm= is not supported for ALTER TABLE with <partition_options>
|
|
- thus disabling parts of this test
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
~ Check table t1 ID has not changed
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
ndb_show_tables completed.....
|
|
|
|
select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
|
|
name
|
|
't1'
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
~ test that aborted online alter rollback DDL transaction
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
# Connection default
|
|
START TRANSACTION;
|
|
SELECT * FROM t1;
|
|
pk a b c
|
|
1 2000 2000 2000
|
|
# Connection con1
|
|
SET lock_wait_timeout=1;
|
|
ALTER TABLE t1 algorithm=inplace, ADD d INT;
|
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
|
ALTER TABLE t1 algorithm=inplace, ADD d INT;
|
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
|
SELECT * FROM t1;
|
|
pk a b c
|
|
1 2000 2000 2000
|
|
COMMIT;
|
|
|
|
ndb_show_tables completed.....
|
|
|
|
select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%';
|
|
name
|
|
't1'
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
~ cleanup section
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
drop table t1, ndb_show_tables_results;
|
|
drop database mysqlslap;
|