| 1 |
# Create t3 with MAX_ROWS set |
| 2 |
let $t3_table_options = MAX_ROWS=333333; |
| 3 |
--source setup.inc |
| 4 |
|
| 5 |
# Test ALTER TABLE .. REORGANIZE PARTITION |
| 6 |
# |
| 7 |
|
| 8 |
--echo # |
| 9 |
--echo # Check that you can specify ALGORITHM=[DEFAULT|COPY|INPLACE] for |
| 10 |
--echo # ALTER TABLE ... REORGANIZE PARTITION |
| 11 |
--echo # |
| 12 |
ALTER TABLE t1 |
| 13 |
algorithm=inplace, |
| 14 |
reorganize partition; |
| 15 |
ALTER TABLE t1 |
| 16 |
algorithm=copy, |
| 17 |
reorganize partition; |
| 18 |
ALTER TABLE t1 |
| 19 |
algorithm=default, |
| 20 |
reorganize partition; |
| 21 |
|
| 22 |
--echo # |
| 23 |
--echo # Check that REORGANIZE PARTITION by default is an inplace |
| 24 |
--echo # operation by not allowing copying alter table and then running |
| 25 |
--echo # a reorg. |
| 26 |
--echo # |
| 27 |
set @@ndb_allow_copying_alter_table = 0; |
| 28 |
ALTER TABLE t1 |
| 29 |
reorganize partition; |
| 30 |
set @@ndb_allow_copying_alter_table = default; |
| 31 |
|
| 32 |
--echo # |
| 33 |
--echo # Check that REORGANIZE PARTITION works also when copying alter is |
| 34 |
--echo # allowed (although it should ofcourse still use inplace per above test). |
| 35 |
--echo # |
| 36 |
ALTER TABLE t1 |
| 37 |
reorganize partition; |
| 38 |
|
| 39 |
|
| 40 |
--echo # |
| 41 |
--echo # Check that inplace REORGANIZE PARTITION is not allowed on a |
| 42 |
--echo # table with MAX_ROWS |
| 43 |
--echo # |
| 44 |
if (!`select LOCATE("max_rows=", CREATE_OPTIONS) |
| 45 |
from information_schema.tables where |
| 46 |
TABLE_SCHEMA='ndb_ddl_test' and TABLE_NAME = 't3'`) |
| 47 |
{ |
| 48 |
die t3 has not MAX_ROWS set; |
| 49 |
} |
| 50 |
|
| 51 |
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON |
| 52 |
ALTER TABLE t3 |
| 53 |
algorithm=inplace, |
| 54 |
reorganize partition; |
| 55 |
|
| 56 |
--echo # |
| 57 |
--echo # Check that implicit copying REORGANIZE PARTITION is allowed on a |
| 58 |
--echo # table with MAX_ROWS |
| 59 |
--echo # |
| 60 |
if (!`select LOCATE("max_rows=", CREATE_OPTIONS) |
| 61 |
from information_schema.tables where |
| 62 |
TABLE_SCHEMA='ndb_ddl_test' and TABLE_NAME = 't3'`) |
| 63 |
{ |
| 64 |
die t3 has not MAX_ROWS set; |
| 65 |
} |
| 66 |
|
| 67 |
ALTER TABLE t3 |
| 68 |
reorganize partition; |
| 69 |
|
| 70 |
--echo # |
| 71 |
--echo # Check that explicit copying REORGANIZE PARTITION is allowed on a |
| 72 |
--echo # table with MAX_ROWS even when copying alter table is not allowed |
| 73 |
--echo # |
| 74 |
if (!`select LOCATE("max_rows=", CREATE_OPTIONS) |
| 75 |
from information_schema.tables where |
| 76 |
TABLE_SCHEMA='ndb_ddl_test' and TABLE_NAME = 't3'`) |
| 77 |
{ |
| 78 |
die t3 has not MAX_ROWS set; |
| 79 |
} |
| 80 |
|
| 81 |
set @@ndb_allow_copying_alter_table = 0; |
| 82 |
ALTER TABLE t3 |
| 83 |
algorithm=copy, |
| 84 |
reorganize partition; |
| 85 |
set @@ndb_allow_copying_alter_table = default; |
| 86 |
|
| 87 |
--echo # |
| 88 |
--echo # Check that implicit copying REORGANIZE PARTITION is prevented on a |
| 89 |
--echo # table with MAX_ROWS when copying alter table is not allowed |
| 90 |
--echo # |
| 91 |
if (!`select LOCATE("max_rows=", CREATE_OPTIONS) |
| 92 |
from information_schema.tables where |
| 93 |
TABLE_SCHEMA='ndb_ddl_test' and TABLE_NAME = 't3'`) |
| 94 |
{ |
| 95 |
die t3 has not MAX_ROWS set; |
| 96 |
} |
| 97 |
|
| 98 |
set @@ndb_allow_copying_alter_table = 0; |
| 99 |
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON |
| 100 |
ALTER TABLE t3 |
| 101 |
reorganize partition; |
| 102 |
set @@ndb_allow_copying_alter_table = default; |
| 103 |
|
| 104 |
|
| 105 |
--source verify_mysql_dd.inc |
| 106 |
|
| 107 |
--source cleanup.inc |
| 108 |
|
| 109 |
|