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