| 1 |
CREATE DATABASE mysqlslap; |
| 2 |
|
| 3 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 4 |
~ basic online alter test during load |
| 5 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 6 |
|
| 7 |
create table t1 (pk int key, a int) engine ndb; |
| 8 |
insert into t1 values (1,0); |
| 9 |
set @t1_id = (select id from ndb_show_tables_results where name like '%t1%' and type like '%UserTable%'); |
| 10 |
|
| 11 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 12 |
~ Starting mysqlslap |
| 13 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 14 |
|
| 15 |
|
| 16 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 17 |
~ Alter table t1 add column b |
| 18 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 19 |
|
| 20 |
ALTER TABLE t1 algorithm=inplace, ADD b INT; |
| 21 |
Warnings: |
| 22 |
Warning 1478 Converted FIXED field 'b' to DYNAMIC to enable online ADD COLUMN |
| 23 |
|
| 24 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 25 |
~ Check table t1 ID has not changed |
| 26 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 27 |
|
| 28 |
select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%'; |
| 29 |
name |
| 30 |
't1' |
| 31 |
|
| 32 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 33 |
~ Starting mysqlslap using column b |
| 34 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 35 |
|
| 36 |
update t1 set b = 0 where pk = 1; |
| 37 |
|
| 38 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 39 |
~ Alter table t1 add column c |
| 40 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 41 |
|
| 42 |
ALTER TABLE t1 algorithm=inplace, ADD c INT; |
| 43 |
Warnings: |
| 44 |
Warning 1478 Converted FIXED field 'c' to DYNAMIC to enable online ADD COLUMN |
| 45 |
|
| 46 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 47 |
~ Check table t1 ID has not changed |
| 48 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 49 |
|
| 50 |
select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%'; |
| 51 |
name |
| 52 |
't1' |
| 53 |
|
| 54 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 55 |
~ Starting mysqlslap using column c |
| 56 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 57 |
|
| 58 |
update t1 set c = 0 where pk = 1; |
| 59 |
select * from t1; |
| 60 |
pk a b c |
| 61 |
1 2000 2000 2000 |
| 62 |
|
| 63 |
BUG#17400320 algorithm= is not supported for ALTER TABLE with <partition_options> |
| 64 |
- thus disabling parts of this test |
| 65 |
|
| 66 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 67 |
~ Check table t1 ID has not changed |
| 68 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 69 |
|
| 70 |
select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%'; |
| 71 |
name |
| 72 |
't1' |
| 73 |
|
| 74 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 75 |
~ test that aborted online alter rollback DDL transaction |
| 76 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 77 |
|
| 78 |
# Connection default |
| 79 |
START TRANSACTION; |
| 80 |
SELECT * FROM t1; |
| 81 |
pk a b c |
| 82 |
1 2000 2000 2000 |
| 83 |
# Connection con1 |
| 84 |
SET lock_wait_timeout=1; |
| 85 |
ALTER TABLE t1 algorithm=inplace, ADD d INT; |
| 86 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 87 |
ALTER TABLE t1 algorithm=inplace, ADD d INT; |
| 88 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 89 |
SELECT * FROM t1; |
| 90 |
pk a b c |
| 91 |
1 2000 2000 2000 |
| 92 |
COMMIT; |
| 93 |
select name from ndb_show_tables_results where id = @t1_id and name like '%t1%' and type like '%UserTable%'; |
| 94 |
name |
| 95 |
't1' |
| 96 |
|
| 97 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 98 |
~ cleanup section |
| 99 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 100 |
|
| 101 |
drop table t1; |
| 102 |
drop database mysqlslap; |