| 1 |
--source include/have_ndb.inc |
| 2 |
--source include/have_debug.inc |
| 3 |
|
| 4 |
# Test that the DDLs are properly disallowed and return proper errors |
| 5 |
# when they are blocked during upgrade |
| 6 |
|
| 7 |
--echo # Setup |
| 8 |
create table t1 (a int) engine ndb; |
| 9 |
create logfile group lg_1 |
| 10 |
add undofile 'undo_1.log' |
| 11 |
initial_size 1M |
| 12 |
undo_buffer_size 2M |
| 13 |
engine ndbcluster; |
| 14 |
create tablespace ts_1 |
| 15 |
add datafile 'data_1.dat' |
| 16 |
use logfile group lg_1 |
| 17 |
initial_size 2M |
| 18 |
engine ndbcluster; |
| 19 |
|
| 20 |
--echo # Restart the MySQL Server to simulate upgrade from a non DD version |
| 21 |
--echo # by enabling the debug flag ndb_simulate_upgrade_from_non_dd_version |
| 22 |
let $restart_parameters = restart: --debug=+d,ndb_simulate_upgrade_from_non_dd_version; |
| 23 |
let $mysqld_name=mysqld.1.1; |
| 24 |
--source include/restart_mysqld.inc |
| 25 |
|
| 26 |
--echo # Try various DDLs and verify that they are blocked |
| 27 |
--echo # Create table |
| 28 |
--error ER_DISALLOWED_OPERATION |
| 29 |
create table t2 (a int) engine ndb; |
| 30 |
|
| 31 |
--echo # Inplace alter |
| 32 |
--error ER_DISALLOWED_OPERATION |
| 33 |
alter table t1 add index idx(a), algorithm = inplace; |
| 34 |
|
| 35 |
--echo # Copy alter |
| 36 |
--error ER_DISALLOWED_OPERATION |
| 37 |
alter table t1 add index idx(a), algorithm = copy; |
| 38 |
|
| 39 |
--echo # Rename table |
| 40 |
--error ER_DISALLOWED_OPERATION |
| 41 |
rename table t1 to t2; |
| 42 |
|
| 43 |
--echo # Drop table |
| 44 |
--error ER_DISALLOWED_OPERATION |
| 45 |
drop table t1; |
| 46 |
|
| 47 |
--echo # Create logfile group |
| 48 |
--error ER_DISALLOWED_OPERATION |
| 49 |
create logfile group lg_2 |
| 50 |
add undofile 'undo_2.log' |
| 51 |
initial_size 1M |
| 52 |
undo_buffer_size 2M |
| 53 |
engine ndbcluster; |
| 54 |
|
| 55 |
--echo # Alter logfile group |
| 56 |
--error ER_DISALLOWED_OPERATION |
| 57 |
alter logfile group lg_1 |
| 58 |
add undofile 'undo_2.log' |
| 59 |
initial_size 1M |
| 60 |
engine ndbcluster; |
| 61 |
|
| 62 |
--echo # Create tablespace |
| 63 |
--error ER_DISALLOWED_OPERATION |
| 64 |
create tablespace ts_2 |
| 65 |
add datafile 'data_2.dat' |
| 66 |
use logfile group lg_1 |
| 67 |
initial_size 2M |
| 68 |
engine ndbcluster; |
| 69 |
|
| 70 |
--echo # Alter tablespace |
| 71 |
--error ER_DISALLOWED_OPERATION |
| 72 |
alter tablespace ts_1 |
| 73 |
add datafile 'data_2.dat' |
| 74 |
initial_size 2M |
| 75 |
engine ndbcluster; |
| 76 |
|
| 77 |
--echo # Verify that database DDLs are still allowed |
| 78 |
create database test1; |
| 79 |
alter database test1 default charset latin1; |
| 80 |
drop database test1; |
| 81 |
|
| 82 |
--echo # Drop database will still fail if it has tables in it |
| 83 |
--error ER_DISALLOWED_OPERATION |
| 84 |
drop database test; |
| 85 |
|
| 86 |
--echo # Any Non-NDB DDLs are allowed |
| 87 |
create table t1_innodb(a int) engine innodb; |
| 88 |
drop table t1_innodb; |
| 89 |
|
| 90 |
--echo # Verify that DDLs are allowed after upgrade |
| 91 |
set GLOBAL debug="-d,ndb_simulate_upgrade_from_non_dd_version"; |
| 92 |
create table t2 (a int) engine ndb; |
| 93 |
show create table t2; |
| 94 |
|
| 95 |
--echo # Cleanup |
| 96 |
drop table t1, t2; |
| 97 |
alter tablespace ts_1 drop datafile 'data_1.dat'; |
| 98 |
drop tablespace ts_1; |
| 99 |
drop logfile group lg_1 engine ndb; |