mariadb/mysql-test/suite/parts/inc/partition_fail_t2.inc
Aleksey Midenkov 69724805bc MDEV-22165 CONVERT TABLE: move in partition from existing table
Syntax for CONVERT TABLE

ALTER TABLE tbl_name CONVERT TABLE tbl_name TO PARTITION partition_name partition_spec

Examples:

    ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 VALUES LESS THAN MAX_VALUE();

New ALTER_PARTITION_CONVERT_IN command for
fast_alter_partition_table() is done in alter_partition_convert_in()
function which basically does ha_rename_table().

Table structure and data check is basically the same as in EXCHANGE
PARTITION command. And these are done by
compare_table_with_partition() and check_table_data().

Atomic DDL is done by the scheme from MDEV-22166 (see the
corresponding commit message). The only differnce is that it also has
to drop source table frm and that is done by WFRM_DROP_CONVERTED_FROM.

Initial patch was done by Dmitry Shulga <dmitry.shulga@mariadb.com>
2021-10-26 17:07:46 +02:00

41 lines
1.1 KiB
PHP

# Include file to test failure with error injection.
# To be used with WL#4445: EXCHANGE PARTITION WITH TABLE.
--eval $create_statement2
--eval $insert_statement2
--eval $create_statement
--eval $insert_statement
--let $dbug_flag= `select @@session.debug_dbug`
--echo # $dbug_flag: BEFORE failure
--replace_result #p# #P#
if (!$DATADIR)
{
--let $DATADIR= `SELECT @@datadir;`
}
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
SHOW CREATE TABLE t2;
--sorted_result
SELECT * FROM t2;
# accept all errors
--disable_abort_on_error
--replace_regex /#sql-exchange-[0-9a-f_\-]*/#sql-exchange/i
--eval $fail_statement
--enable_abort_on_error
--echo # $dbug_flag: AFTER failure
--replace_result #p# #P#
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
DROP TABLE t1;
--error 0, ER_NO_SUCH_TABLE
SHOW CREATE TABLE t2;
--sorted_result
--error 0, ER_NO_SUCH_TABLE
SELECT * FROM t2;
# TODO: everything fails with ER_NO_SUCH_TABLE
# but DROP TABLE fails with ER_BAD_TABLE_ERROR! Why?
--error 0, ER_BAD_TABLE_ERROR
DROP TABLE t2;