mirror of
https://github.com/MariaDB/server.git
synced 2025-09-09 18:40:27 +03:00
This is a complete rewrite of DROP TABLE, also as part of other DDL, such as ALTER TABLE, CREATE TABLE...SELECT, TRUNCATE TABLE. The background DROP TABLE queue hack is removed. If a transaction needs to drop and create a table by the same name (like TRUNCATE TABLE does), it must first rename the table to an internal #sql-ib name. No committed version of the data dictionary will include any #sql-ib tables, because whenever a transaction renames a table to a #sql-ib name, it will also drop that table. Either the rename will be rolled back, or the drop will be committed. Data files will be unlinked after the transaction has been committed and a FILE_RENAME record has been durably written. The file will actually be deleted when the detached file handle returned by fil_delete_tablespace() will be closed, after the latches have been released. It is possible that a purge of the delete of the SYS_INDEXES record for the clustered index will execute fil_delete_tablespace() concurrently with the DDL transaction. In that case, the thread that arrives later will wait for the other thread to finish. HTON_TRUNCATE_REQUIRES_EXCLUSIVE_USE: A new handler flag. ha_innobase::truncate() now requires that all other references to the table be released in advance. This was implemented by Monty. ha_innobase::delete_table(): If CREATE TABLE..SELECT is detected, we will "hijack" the current transaction, drop the table in the current transaction and commit the current transaction. This essentially fixes MDEV-21602. There is a FIXME comment about making the check less failure-prone. ha_innobase::truncate(), ha_innobase::delete_table(): Implement a fast path for temporary tables. We will no longer allow temporary tables to use the adaptive hash index. dict_table_t::mdl_name: The original table name for the purpose of acquiring MDL in purge, to prevent a race condition between a DDL transaction that is dropping a table, and purge processing undo log records of DML that had executed before the DDL operation. For #sql-backup- tables during ALTER TABLE...ALGORITHM=COPY, the dict_table_t::mdl_name will differ from dict_table_t::name. dict_table_t::parse_name(): Use mdl_name instead of name. dict_table_rename_in_cache(): Update mdl_name. For the internal FTS_ tables of FULLTEXT INDEX, purge would acquire MDL on the FTS_ table name, but not on the main table, and therefore it would be able to run concurrently with a DDL transaction that is dropping the table. Previously, the DROP TABLE queue hack prevented a race between purge and DDL. For now, we introduce purge_sys.stop_FTS() to prevent purge from opening any table, while a DDL transaction that may drop FTS_ tables is in progress. The function fts_lock_table(), which will be invoked before the dictionary is locked, will wait for purge to release any table handles. trx_t::drop_table_statistics(): Drop statistics for the table. This replaces dict_stats_drop_index(). We will drop or rename persistent statistics atomically as part of DDL transactions. On lock conflict for dropping statistics, we will fail instantly with DB_LOCK_WAIT_TIMEOUT, because we will be holding the exclusive data dictionary latch. trx_t::commit_cleanup(): Separated from trx_t::commit_in_memory(). Relax an assertion around fts_commit() and allow DB_LOCK_WAIT_TIMEOUT in addition to DB_DUPLICATE_KEY. The call to fts_commit() is entirely misplaced here and may obviously break the consistency of transactions that affect FULLTEXT INDEX. It needs to be fixed separately. dict_table_t::n_foreign_key_checks_running: Remove (MDEV-21175). The counter was a work-around for missing meta-data locking (MDL) on the SQL layer, and not really needed in MariaDB. ER_TABLE_IN_FK_CHECK: Replaced with ER_UNUSED_28. HA_ERR_TABLE_IN_FK_CHECK: Remove. row_ins_check_foreign_constraints(): Do not acquire dict_sys.latch either. The SQL-layer MDL will protect us. This was reviewed by Thirunarayanan Balathandayuthapani and tested by Matthias Leich.
1390 lines
29 KiB
Plaintext
1390 lines
29 KiB
Plaintext
# mysql-test-run.pl --embedded cannot restart the server.
|
|
--source include/not_embedded.inc
|
|
|
|
# Adding big test option for this test.
|
|
--source include/big_test.inc
|
|
|
|
# This test case needs to crash the server. Needs a debug server.
|
|
--source include/have_debug.inc
|
|
|
|
# Don't test this under valgrind, memory leaks will occur.
|
|
--source include/not_valgrind.inc
|
|
|
|
# Avoid CrashReporter popup on Mac
|
|
--source include/not_crashrep.inc
|
|
|
|
--source include/have_innodb.inc
|
|
--source include/default_charset.inc
|
|
--source include/have_sequence.inc
|
|
|
|
let $restart_noprint=2;
|
|
call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation.");
|
|
call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified.");
|
|
call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: .*");
|
|
call mtr.add_suppression("InnoDB: Ignoring tablespace .* because it could not be opened.");
|
|
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
|
|
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .*");
|
|
call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file");
|
|
call mtr.add_suppression("InnoDB: Page for tablespace ");
|
|
call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=");
|
|
call mtr.add_suppression("InnoDB: Unknown index id .* on page");
|
|
FLUSH TABLES;
|
|
|
|
let MYSQLD_DATADIR =`SELECT @@datadir`;
|
|
let $strerrfix=/ (\(.+\))//;
|
|
SET GLOBAL innodb_file_per_table = 1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB;
|
|
INSERT INTO t1 VALUES(1),(2),(3);
|
|
|
|
--let $_server_id= `SELECT @@server_id`
|
|
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
|
|
|
|
--exec echo wait > $_expect_file_name
|
|
SET SESSION debug_dbug="+d,ib_discard_before_commit_crash";
|
|
--error 2013
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--source include/start_mysqld.inc
|
|
|
|
DROP TABLE t1;
|
|
|
|
SET GLOBAL innodb_file_per_table = 1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB;
|
|
INSERT INTO t1 VALUES(1),(2),(3);
|
|
|
|
--exec echo wait > $_expect_file_name
|
|
SET SESSION debug_dbug="+d,ib_discard_after_commit_crash";
|
|
--error 2013
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--source include/start_mysqld.inc
|
|
|
|
DROP TABLE t1;
|
|
|
|
SET GLOBAL innodb_file_per_table = 1;
|
|
|
|
# Create the table that we will use for crash recovery (during IMPORT)
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1), (2), (3), (4);
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_backup_tablespaces("test", "t1");
|
|
EOF
|
|
UNLOCK TABLES;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT * FROM t1;
|
|
|
|
--exec echo wait > $_expect_file_name
|
|
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
|
|
--error 2013
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
--source include/start_mysqld.inc
|
|
|
|
# Check that the DD is consistent after recovery
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
--exec echo wait > $_expect_file_name
|
|
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
|
|
--error 2013
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
# After the above test the results are non-deterministic,
|
|
# delete the old tablespace files and drop the table,
|
|
# recreate the table and do a proper import.
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
--source include/start_mysqld.inc
|
|
|
|
DROP TABLE t1;
|
|
|
|
SET @file_per_table= @@innodb_file_per_table;
|
|
SET GLOBAL innodb_file_per_table = 1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
CHECK TABLE t1;
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
INSERT INTO t1 VALUES(400), (500), (600);
|
|
|
|
SELECT * FROM t1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
# Test IO Write error(s), flush tables doesn't return an error message
|
|
# so we have to make do with the error/warning pushed by the server
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
|
SET SESSION debug_dbug="+d,ib_export_io_write_failure_1";
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
SET SESSION debug_dbug="+d,ib_export_io_write_failure_2";
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
SET SESSION debug_dbug="+d,ib_export_io_write_failure_3";
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
SET SESSION debug_dbug="+d,ib_export_io_write_failure_4";
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
SET SESSION debug_dbug="+d,ib_export_io_write_failure_5";
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
SET SESSION debug_dbug="+d,ib_export_io_write_failure_6";
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
SET SESSION debug_dbug="+d,ib_export_io_write_failure_7";
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
SET SESSION debug_dbug="+d,ib_export_io_write_failure_8";
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
SET SESSION debug_dbug="+d,ib_export_io_write_failure_9";
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
SET SESSION debug_dbug="+d,ib_export_io_write_failure_10";
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
SET SESSION debug_dbug="+d,ib_export_io_write_failure_11";
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
SET SESSION debug_dbug="+d,ib_export_io_write_failure_12";
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
# Create a table and save the tablespace and .cfg file
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (100), (200), (300);
|
|
SELECT COUNT(*) FROM t1;
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_backup_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
UNLOCK TABLES;
|
|
|
|
DROP TABLE t1;
|
|
|
|
# Test IO Read error(s)
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_io_read_error_1";
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_cfg_files("test", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_io_read_error_2";
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_cfg_files("test", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_io_read_error_3";
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_cfg_files("test", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_io_read_error_4";
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_cfg_files("test", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_io_read_error_5";
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_cfg_files("test", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_io_read_error_6";
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_cfg_files("test", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_io_read_error_7";
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_cfg_files("test", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_io_read_error_8";
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_cfg_files("test", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_io_read_error_9";
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_cfg_files("test", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
# Test string read failure
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_string_read_error";
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_cfg_files("test", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
# Test OOM error during import
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_1";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_2";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_4";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_5";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_6";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_7";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_8";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_9";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_10";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
####
|
|
# Test handling of internal failure error
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
# Test failure after reset of space id and LSN in the tablespace
|
|
SET SESSION debug_dbug="+d,ib_import_internal_error";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_INTERNAL_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
# Test failure after reset of space id and LSN in the tablespace
|
|
CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
# Test failure after reset of space id and LSN in the tablespace
|
|
SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_INTERNAL_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
# Test failure after attempting a tablespace open
|
|
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
|
|
|
|
--replace_result \\ /
|
|
--error ER_GET_ERRMSG
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
# Test failure after ibuf check
|
|
SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure";
|
|
|
|
# Need proper mapping of error codes :-(
|
|
--error ER_NOT_KEYFILE
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
# Test failure after adjusting the cluster index root page
|
|
SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure";
|
|
|
|
--error ER_NOT_KEYFILE
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
# Test failure after importing the cluster index
|
|
SET SESSION debug_dbug="+d,ib_import_cluster_failure";
|
|
|
|
--error ER_NOT_KEYFILE
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
# Test failure after importing the secondary index(es)
|
|
SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure";
|
|
|
|
--error ER_NOT_KEYFILE
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Create a large table with delete marked records, disable purge during
|
|
# the update so that we can test the IMPORT purge code.
|
|
#
|
|
CREATE TABLE t1 (
|
|
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
c2 BIGINT,
|
|
c3 VARCHAR(2048),
|
|
c4 VARCHAR(2048),
|
|
INDEX idx1(c2),
|
|
INDEX idx2(c3(512)),
|
|
INDEX idx3(c4(512))) Engine=InnoDB;
|
|
|
|
# Stop purge so that it doesn't remove the delete marked entries.
|
|
connect (purge_control,localhost,root);
|
|
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
|
connection default;
|
|
|
|
INSERT INTO t1
|
|
SELECT 1 + seq, 1 + (seq MOD 4),
|
|
REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048),
|
|
REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048)
|
|
FROM seq_0_to_127;
|
|
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c2 = c2 + c1;
|
|
UPDATE t1 SET c3 = REPEAT("c2", 1024);
|
|
UPDATE t1 SET c4 = REPEAT("c4", 1024);
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT c1, c2 FROM t1;
|
|
SELECT COUNT(*) FROM t1;
|
|
SELECT SUM(c2) FROM t1;
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_backup_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
UNLOCK TABLES;
|
|
|
|
# Enable normal operation
|
|
connection purge_control;
|
|
COMMIT;
|
|
disconnect purge_control;
|
|
connection default;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (
|
|
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
c2 BIGINT,
|
|
c3 VARCHAR(2048),
|
|
c4 VARCHAR(2048),
|
|
INDEX idx1(c2),
|
|
INDEX idx2(c3(512)),
|
|
INDEX idx3(c4(512))) Engine=InnoDB;
|
|
|
|
SELECT c1, c2 FROM t1;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
CHECK TABLE t1;
|
|
|
|
SELECT c1,c2 FROM t1;
|
|
SELECT COUNT(*) FROM t1;
|
|
SELECT SUM(c2) FROM t1;
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
####
|
|
# Create a table and save the tablespace and .cfg file, we need to create
|
|
# a Btree that has several levels
|
|
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
INSERT IGNORE INTO t1 VALUES
|
|
(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 2731));
|
|
|
|
INSERT INTO t1
|
|
SELECT 100, REPEAT('Karanbir', 128), REPEAT('Ajeeth', 1200)
|
|
FROM seq_1_to_256;
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_backup_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
UNLOCK TABLES;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_INTERNAL_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
#
|
|
|
|
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_INTERNAL_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
#
|
|
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2";
|
|
|
|
--error ER_INNODB_INDEX_CORRUPT
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
#
|
|
|
|
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3";
|
|
|
|
--error ER_NOT_KEYFILE
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
|
|
|
|
--error ER_RECORD_FILE_FULL
|
|
ALTER TABLE t1 ADD INDEX idx(c1);
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
ALTER TABLE t1 ADD INDEX idx(c1);
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
#
|
|
|
|
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,fil_space_create_failure";
|
|
|
|
--replace_result \\ /
|
|
--error ER_GET_ERRMSG
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
#
|
|
|
|
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
|
|
|
|
--replace_result \\ /
|
|
--error ER_GET_ERRMSG
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
#
|
|
|
|
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_INTERNAL_ERROR
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test", "t1");
|
|
EOF
|
|
|
|
--disable_query_log
|
|
call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles!");
|
|
call mtr.add_suppression("'Resource temporarily unavailable'");
|
|
call mtr.add_suppression("Got error -1 when reading table '.*'");
|
|
call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded.");
|
|
call mtr.add_suppression("InnoDB: Tablespace '.*' exists in the cache.*");
|
|
call mtr.add_suppression("InnoDB: Freeing existing tablespace '.*' entry from the cache with id.*");
|
|
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
|
|
call mtr.add_suppression(".*There was an error writing to the meta data file.*");
|
|
call mtr.add_suppression("InnoDB: Trying to import a tablespace, but could not open the tablespace file");
|
|
call mtr.add_suppression("Unsupported tablespace format");
|
|
call mtr.add_suppression("Page is marked as free");
|
|
call mtr.add_suppression("t1.ibd: Page .* at offset .* looks corrupted");
|
|
call mtr.add_suppression("but tablespace with that id or name does not exist");
|
|
call mtr.add_suppression("Could not find a valid tablespace file for '.*t1'");
|
|
call mtr.add_suppression("while reading index meta-data, expected to read 44 bytes but read only 0 bytes");
|
|
call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it");
|
|
--enable_query_log
|
|
|
|
#cleanup
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
|
|
|
|
SET GLOBAL INNODB_FILE_PER_TABLE=@file_per_table;
|