mirror of
https://github.com/MariaDB/server.git
synced 2025-09-06 19:08:06 +03:00
We will remove the InnoDB background operation of merging buffered changes to secondary index leaf pages. Changes will only be merged as a result of an operation that accesses a secondary index leaf page, such as a SQL statement that performs a lookup via that index, or is modifying the index. Also ROLLBACK and some background operations, such as purging the history of committed transactions, or computing index cardinality statistics, can cause change buffer merge. Encryption key rotation will not perform change buffer merge. The motivation of this change is to simplify the I/O logic and to allow crash recovery to happen in the background (MDEV-14481). We also hope that this will reduce the number of "mystery" crashes due to corrupted data. Because change buffer merge will typically take place as a result of executing SQL statements, there should be a clearer connection between the crash and the SQL statements that were executed when the server crashed. In many cases, a slight performance improvement was observed. This is joint work with Thirunarayanan Balathandayuthapani and was tested by Axel Schwenke and Matthias Leich. The InnoDB monitor counter innodb_ibuf_merge_usec will be removed. On slow shutdown (innodb_fast_shutdown=0), we will continue to merge all buffered changes (and purge all undo log history). Two InnoDB configuration parameters will be changed as follows: innodb_disable_background_merge: Removed. This parameter existed only in debug builds. All change buffer merges will use synchronous reads. innodb_force_recovery will be changed as follows: * innodb_force_recovery=4 will be the same as innodb_force_recovery=3 (the change buffer merge cannot be disabled; it can only happen as a result of an operation that accesses a secondary index leaf page). The option used to be capable of corrupting secondary index leaf pages. Now that capability is removed, and innodb_force_recovery=4 becomes 'safe'. * innodb_force_recovery=5 (which essentially hard-wires SET GLOBAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED) becomes safe to use. Bogus data can be returned to SQL, but persistent InnoDB data files will not be corrupted further. * innodb_force_recovery=6 (ignore the redo log files) will be the only option that can potentially cause persistent corruption of InnoDB data files. Code changes: buf_page_t::ibuf_exist: New flag, to indicate whether buffered changes exist for a buffer pool page. Pages with pending changes can be returned by buf_page_get_gen(). Previously, the changes were always merged inside buf_page_get_gen() if needed. ibuf_page_exists(const buf_page_t&): Check if a buffered changes exist for an X-latched or read-fixed page. buf_page_get_gen(): Add the parameter allow_ibuf_merge=false. All callers that know that they may be accessing a secondary index leaf page must pass this parameter as allow_ibuf_merge=true, unless it does not matter for that caller whether all buffered changes have been applied. Assert that whenever allow_ibuf_merge holds, the page actually is a leaf page. Attempt change buffer merge only to secondary B-tree index leaf pages. btr_block_get(): Add parameter 'bool merge'. All callers of btr_block_get() should know whether the page could be a secondary index leaf page. If it is not, we should avoid consulting the change buffer bitmap to even consider a merge. This is the main interface to requesting index pages from the buffer pool. ibuf_merge_or_delete_for_page(), recv_recover_page(): Replace buf_page_get_known_nowait() with much simpler logic, because it is now guaranteed that that the block is x-latched or read-fixed. mlog_init_t::mark_ibuf_exist(): Renamed from mlog_init_t::ibuf_merge(). On crash recovery, we will no longer merge any buffered changes for the pages that we read into the buffer pool during the last batch of applying log records. buf_page_get_gen_known_nowait(), BUF_MAKE_YOUNG, BUF_KEEP_OLD: Remove. btr_search_guess_on_hash(): Merge buf_page_get_gen_known_nowait() to its only remaining caller. buf_page_make_young_if_needed(): Define as an inline function. Add the parameter buf_pool. buf_page_peek_if_young(), buf_page_peek_if_too_old(): Add the parameter buf_pool. fil_space_validate_for_mtr_commit(): Remove a bogus comment about background merge of the change buffer. btr_cur_open_at_rnd_pos_func(), btr_cur_search_to_nth_level_func(), btr_cur_open_at_index_side_func(): Use narrower data types and scopes. ibuf_read_merge_pages(): Replaces buf_read_ibuf_merge_pages(). Merge the change buffer by invoking buf_page_get_gen().
1451 lines
36 KiB
Plaintext
1451 lines
36 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
|
|
|
|
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: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.");
|
|
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=");
|
|
FLUSH TABLES;
|
|
|
|
let MYSQLD_DATADIR =`SELECT @@datadir`;
|
|
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
|
|
let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522\\t1.ibd'/;
|
|
let $strerrfix=/ (\(.+\))//;
|
|
|
|
SET GLOBAL innodb_file_per_table = 1;
|
|
|
|
CREATE DATABASE test_wl5522;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--source include/start_mysqld.inc
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
SET GLOBAL innodb_file_per_table = 1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--source include/start_mysqld.inc
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
SET GLOBAL innodb_file_per_table = 1;
|
|
|
|
# Create the table that we will use for crash recovery (during IMPORT)
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
|
|
|
|
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
|
|
|
|
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_backup_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
UNLOCK TABLES;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT * FROM test_wl5522.t1;
|
|
|
|
--exec echo wait > $_expect_file_name
|
|
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
|
|
--error 2013
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
--source include/start_mysqld.inc
|
|
|
|
# Check that the DD is consistent after recovery
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
--exec echo wait > $_expect_file_name
|
|
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
|
|
--error 2013
|
|
ALTER TABLE test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
--source include/start_mysqld.inc
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
SET GLOBAL innodb_file_per_table = 1;
|
|
SELECT @@innodb_file_per_table;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
CHECK TABLE test_wl5522.t1;
|
|
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
INSERT INTO test_wl5522.t1 VALUES(400), (500), (600);
|
|
|
|
SELECT * FROM test_wl5522.t1;
|
|
|
|
DROP TABLE test_wl5522.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 test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.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 test_wl5522.t1 FOR EXPORT;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
# Create a table and save the tablespace and .cfg file
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (100), (200), (300);
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_backup_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
UNLOCK TABLES;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
# Test IO Read error(s)
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
# Test string read failure
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
--replace_regex $strerrfix
|
|
|
|
--error ER_IO_READ_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
# Test OOM error during import
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_1";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_2";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_4";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_5";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_6";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_7";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_8";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_9";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
INSERT INTO test_wl5522.t1 VALUES (1);
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_OOM_10";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_OUT_OF_RESOURCES
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
####
|
|
# Test handling of internal failure error
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "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 test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
|
|
# Test failure after reset of space id and LSN in the tablespace
|
|
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "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 test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "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_regex /file: '.*t1.ibd'/'t1.ibd'/
|
|
|
|
--error ER_GET_ERRMSG
|
|
ALTER TABLE test_wl5522.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_wl5522", "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 test_wl5522.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_wl5522", "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 test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
# Test failure after importing the cluster index
|
|
SET SESSION debug_dbug="+d,ib_import_cluster_failure";
|
|
|
|
--error ER_NOT_KEYFILE
|
|
ALTER TABLE test_wl5522.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_wl5522", "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 test_wl5522.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_wl5522", "t1");
|
|
EOF
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
--disable_query_log
|
|
# Enable metrics for the counters we are going to use
|
|
set global innodb_monitor_enable = purge_stop_count;
|
|
set global innodb_monitor_enable = purge_resume_count;
|
|
set global innodb_monitor_enable = ibuf_merges;
|
|
set global innodb_monitor_enable = ibuf_merges_insert;
|
|
--enable_query_log
|
|
|
|
#
|
|
# Create a large table with delete marked records, disable purge during
|
|
# the update so that we can test the IMPORT purge code.
|
|
#
|
|
CREATE TABLE test_wl5522.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;
|
|
|
|
SET GLOBAL innodb_monitor_reset = ibuf_merges;
|
|
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
|
|
|
|
INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES
|
|
(1, REPEAT('a', 2048), REPEAT('a', 2048)),
|
|
(2, REPEAT('b', 2048), REPEAT('b', 2048)),
|
|
(3, REPEAT('c', 2048), REPEAT('c', 2048)),
|
|
(4, REPEAT('d', 2048), REPEAT('d', 2048));
|
|
|
|
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
|
|
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
|
|
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
|
|
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
|
|
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
|
|
|
|
DELETE FROM test_wl5522.t1 WHERE c2 = 1;
|
|
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
|
|
UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024);
|
|
UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024);
|
|
|
|
SHOW CREATE TABLE test_wl5522.t1;
|
|
|
|
SELECT c1, c2 FROM test_wl5522.t1;
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
SELECT SUM(c2) FROM test_wl5522.t1;
|
|
|
|
SELECT name
|
|
FROM information_schema.innodb_metrics
|
|
WHERE name = 'ibuf_merges_insert' AND count = 0;
|
|
|
|
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_backup_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
UNLOCK TABLES;
|
|
|
|
SELECT name
|
|
FROM information_schema.innodb_metrics
|
|
WHERE name = 'ibuf_merges' AND count > 0;
|
|
|
|
SELECT name
|
|
FROM information_schema.innodb_metrics
|
|
WHERE name = 'ibuf_merges_inserts' AND count > 0;
|
|
|
|
# Enable normal operation
|
|
connection purge_control;
|
|
COMMIT;
|
|
disconnect purge_control;
|
|
connection default;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.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 test_wl5522.t1;
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
CHECK TABLE test_wl5522.t1;
|
|
|
|
SELECT c1,c2 FROM test_wl5522.t1;
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
SELECT SUM(c2) FROM test_wl5522.t1;
|
|
|
|
SHOW CREATE TABLE test_wl5522.t1;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
####
|
|
# Create a table and save the tablespace and .cfg file, we need to create
|
|
# a Btree that has several levels
|
|
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
INSERT IGNORE INTO test_wl5522.t1 VALUES
|
|
(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 2731));
|
|
|
|
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
|
|
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
|
|
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
|
|
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
|
|
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
|
|
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
|
|
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
|
|
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_backup_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
UNLOCK TABLES;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_INTERNAL_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
#
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_INTERNAL_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
#
|
|
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2";
|
|
|
|
--replace_regex $pathfix
|
|
|
|
--error ER_INNODB_INDEX_CORRUPT
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
#
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3";
|
|
|
|
--replace_regex $pathfix
|
|
|
|
--error ER_NOT_KEYFILE
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
|
|
|
|
ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
#
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,fil_space_create_failure";
|
|
|
|
--replace_regex $pathfix
|
|
|
|
--error ER_GET_ERRMSG
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
#
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
|
|
|
|
--replace_regex $pathfix
|
|
|
|
--error ER_GET_ERRMSG
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
#
|
|
|
|
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
|
|
|
|
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
SELECT COUNT(*) FROM test_wl5522.t1;
|
|
|
|
# Restore files
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_restore_tablespaces("test_wl5522", "t1");
|
|
EOF
|
|
|
|
SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure";
|
|
|
|
--replace_regex /'.*t1.cfg'/'t1.cfg'/
|
|
|
|
--error ER_INTERNAL_ERROR
|
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
|
|
|
SET SESSION debug_dbug=@saved_debug_dbug;
|
|
|
|
DROP TABLE test_wl5522.t1;
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
ib_unlink_tablespace("test_wl5522", "t1");
|
|
EOF
|
|
|
|
|
|
DROP DATABASE test_wl5522;
|
|
|
|
set global innodb_monitor_disable = all;
|
|
set global innodb_monitor_reset_all = all;
|
|
|
|
-- disable_warnings
|
|
set global innodb_monitor_enable = default;
|
|
set global innodb_monitor_disable = default;
|
|
set global innodb_monitor_reset = default;
|
|
set global innodb_monitor_reset_all = default;
|
|
-- enable_warnings
|
|
|
|
--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("Monitor ibuf_merges is already enabled");
|
|
call mtr.add_suppression("Monitor ibuf_merges_insert is already enabled");
|
|
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("Error in page .* of index \"GEN_CLUST_INDEX\" of table \"test_wl5522\".\"t1\"");
|
|
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("Failed to find tablespace for table '\"test_wl5522\".\"t1\"' in the cache");
|
|
call mtr.add_suppression("Could not find a valid tablespace file for 'test_wl5522.*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
|
|
|
|
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
|