Commit 78153cf6 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-11927 InnoDB change buffer is not being merged

to tables in the system tablespace

This is a regression caused by MDEV-11585, which accidentally
changed Tablespace::is_undo_tablespace() in an incorrect way,
causing the InnoDB system tablespace to be reported as a dedicated
undo tablespace, for which the change buffer is not applicable.

Tablespace::is_undo_tablespace(): Remove. There were only 2
calls from the function buf_page_io_complete(). Replace those
calls as appropriate.

Also, merge changes to tablespace import/export tests from
MySQL 5.7, and clean up the tests a little further, allowing
them to be run with any innodb_page_size.

Remove duplicated error injection instrumentation for the
import/export tests.  In MySQL 5.7, the error injection label
buf_page_is_corrupt_failure was renamed to
buf_page_import_corrupt_failure.

fil_space_extend_must_retry(): Correct a debug assertion
(tablespaces can be extended during IMPORT), and remove a
TODO comment about compressed temporary tables that was
already addressed in MDEV-11816.

dict_build_tablespace_for_table(): Correct a comment that
no longer holds after MDEV-11816, and assert that
ROW_FORMAT=COMPRESSED can only be used in .ibd files.
parent b513e371
......@@ -42,5 +42,3 @@ galera_sst_xtrabackup-v2 : MDEV-11208
galera_sst_xtrabackup-v2_encrypt_with_key : MDEV-11208
mysql-wsrep#33 : TODO: investigate
galera_var_innodb_disallow_writes : MDEV-10949
galera_many_tables_pk : MDEV-11927
galera_many_tables_nopk : MDEV-11927
......@@ -17,23 +17,18 @@ DROP DATABASE IF EXISTS test_wl5522;
Warnings:
Note 1008 Can't drop database 'test_wl5522'; database doesn't exist
CREATE DATABASE test_wl5522;
SET SESSION debug_dbug="+d,ib_discard_before_commit_crash";
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
INSERT INTO test_wl5522.t1 VALUES(1),(2),(3);
SET SESSION debug_dbug="+d,ib_discard_before_commit_crash";
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
SET SESSION debug_dbug="-d,ib_discard_before_commit_crash";
DROP TABLE test_wl5522.t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
SET SESSION debug_dbug="+d,ib_discard_after_commit_crash";
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
INSERT INTO test_wl5522.t1 VALUES(1),(2),(3);
SET SESSION debug_dbug="+d,ib_discard_after_commit_crash";
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
SET SESSION debug_dbug="-d,ib_discard_after_commit_crash";
DROP TABLE test_wl5522.t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
......@@ -51,21 +46,18 @@ ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
SELECT * FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
SET SESSION debug_dbug="-d,ib_import_before_commit_crash";
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
unlink: t1.ibd
unlink: t1.cfg
# Restart and reconnect to the server
SET SESSION debug_dbug="-d,ib_import_before_checkpoint_crash";
DROP TABLE test_wl5522.t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
......@@ -94,13 +86,14 @@ c1
DROP TABLE test_wl5522.t1;
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";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_1";
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);
......@@ -110,7 +103,7 @@ Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_2";
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);
......@@ -120,7 +113,7 @@ Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_3";
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);
......@@ -130,7 +123,7 @@ Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_4";
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);
......@@ -140,7 +133,7 @@ Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_5";
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);
......@@ -150,7 +143,7 @@ Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_6";
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);
......@@ -160,7 +153,7 @@ Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_7";
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);
......@@ -170,7 +163,7 @@ Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_8";
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);
......@@ -180,7 +173,7 @@ Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_9";
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);
......@@ -190,7 +183,7 @@ Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_10";
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);
......@@ -200,7 +193,7 @@ Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_11";
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);
......@@ -210,7 +203,7 @@ Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_12";
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 (100), (200), (300);
......@@ -230,7 +223,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_1";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading index fields.
SET SESSION debug_dbug="-d,ib_import_io_read_error_1";
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);
......@@ -241,7 +234,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_2";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading index meta-data, expected to read 44 bytes but read only 0 bytes
SET SESSION debug_dbug="-d,ib_import_io_read_error_2";
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);
......@@ -252,7 +245,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_3";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading number of indexes.
SET SESSION debug_dbug="-d,ib_import_io_read_error_3";
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);
......@@ -263,7 +256,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_4";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading table column meta-data.
SET SESSION debug_dbug="-d,ib_import_io_read_error_4";
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);
......@@ -274,7 +267,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_5";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading meta-data export hostname length.
SET SESSION debug_dbug="-d,ib_import_io_read_error_5";
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);
......@@ -285,7 +278,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_6";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading meta-data table name length.
SET SESSION debug_dbug="-d,ib_import_io_read_error_6";
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);
......@@ -296,7 +289,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_7";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading autoinc value.
SET SESSION debug_dbug="-d,ib_import_io_read_error_7";
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);
......@@ -307,7 +300,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_8";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading meta-data header.
SET SESSION debug_dbug="-d,ib_import_io_read_error_8";
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);
......@@ -318,7 +311,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_9";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading meta-data version.
SET SESSION debug_dbug="-d,ib_import_io_read_error_9";
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);
......@@ -329,7 +322,7 @@ SET SESSION debug_dbug="+d,ib_import_string_read_error";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while parsing export hostname.
SET SESSION debug_dbug="-d,ib_import_string_read_error";
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);
......@@ -340,7 +333,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_1";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_1";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -353,7 +346,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_2";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_2";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -366,7 +359,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_4";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_4";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -379,7 +372,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_5";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_5";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -392,7 +385,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_6";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_6";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -405,7 +398,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_7";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_7";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -418,7 +411,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_8";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_8";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -431,7 +424,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_9";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_9";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -444,7 +437,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_10";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_10";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -456,7 +449,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_internal_error";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: While updating the <space, root page number> of index GEN_CLUST_INDEX - Generic error
SET SESSION debug_dbug="-d,ib_import_internal_error";
SET SESSION debug_dbug=@saved_debug_dbug;
restore: t1 .ibd and .cfg files
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
DROP TABLE test_wl5522.t1;
......@@ -469,36 +462,36 @@ SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Too many concurrent transactions
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Got error 44 'Tablespace not found' from ./test_wl5522/t1.ibd
SET SESSION debug_dbug="-d,ib_import_open_tablespace_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
SET SESSION debug_dbug="-d,ib_import_check_bitmap_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
SET SESSION debug_dbug="-d,ib_import_cluster_root_adjust_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_cluster_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
SET SESSION debug_dbug="-d,ib_import_cluster_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
SET SESSION debug_dbug="-d,ib_import_sec_root_adjust_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
SET SESSION debug_dbug="-d,ib_import_set_max_rowid_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE test_wl5522.t1;
......@@ -838,7 +831,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_1";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -847,10 +840,10 @@ ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,buf_page_is_corrupt_failure";
SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
SET SESSION debug_dbug="-d,buf_page_is_corrupt_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -862,7 +855,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Index corrupt: Externally stored column(5) has a reference length of 19 in the cluster index GEN_CLUST_INDEX
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_2";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -874,7 +867,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_3";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -886,7 +879,7 @@ SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
Warnings:
Warning 1814 Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="-d,ib_import_create_index_failure_1";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -898,7 +891,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,fil_space_create_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Got error 11 'Generic error' from ./test_wl5522/t1.ibd
SET SESSION debug_dbug="-d,fil_space_create_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -910,7 +903,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Got error 39 'Data structure corruption' from ./test_wl5522/t1.ibd
SET SESSION debug_dbug="-d,dict_tf_to_fsp_flags_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......@@ -922,7 +915,7 @@ restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
SET SESSION debug_dbug="-d,fsp_flags_is_valid_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
......
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it");
FLUSH TABLES;
CREATE TABLE t1
(a INT AUTO_INCREMENT PRIMARY KEY,
......@@ -29,15 +30,19 @@ a b c
823 Evolution lsjndofiabsoibeg
822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf
CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT;
t1.frm
t1.ibd
# Restarting server
# Done restarting server
FLUSH TABLE t1 FOR EXPORT;
t2.frm
t2.ibd
FLUSH TABLE t1, t2 FOR EXPORT;
# List before copying files
t1.cfg
t1.frm
t1.ibd
t2.cfg
t2.frm
t2.ibd
UNLOCK TABLES;
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t1;
......@@ -58,9 +63,13 @@ a b c
# List before t1 DISCARD
t1.frm
t1.ibd
t2.frm
t2.ibd
ALTER TABLE t1 DISCARD TABLESPACE;
# List after t1 DISCARD
t1.frm
t2.frm
t2.ibd
ALTER TABLE t1 IMPORT TABLESPACE;
ALTER TABLE t1 ENGINE InnoDB;
SELECT COUNT(*) FROM t1;
......@@ -79,6 +88,8 @@ a b c
t1.cfg
t1.frm
t1.ibd
t2.frm
t2.ibd
SELECT COUNT(*) FROM t1;
COUNT(*)
640
......@@ -93,6 +104,19 @@ a b c
822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf
DROP TABLE t1;
ALTER TABLE t2 ROW_FORMAT=DYNAMIC;
ALTER TABLE t2 DISCARD TABLESPACE;
# List after t2 DISCARD
t2.frm
ALTER TABLE t2 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x4 and the meta-data file has 0x1)
ALTER TABLE t2 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Expected FSP_SPACE_FLAGS=0x*, .ibd file contains 0x*.)
DROP TABLE t2;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
......
# Not supported in embedded
# mysql-test-run.pl --embedded cannot restart the server.
--source include/not_embedded.inc
# Adding big test option for this test.
......@@ -38,50 +38,34 @@ SELECT @@innodb_file_per_table;
DROP DATABASE IF EXISTS test_wl5522;
CREATE DATABASE test_wl5522;
##### Before DISCARD commit crash
SET SESSION debug_dbug="+d,ib_discard_before_commit_crash";
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
INSERT INTO test_wl5522.t1 VALUES(1),(2),(3);
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--let $_server_id= `SELECT @@server_id`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
# Execute the statement that causes the crash
--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;
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
--source include/start_mysqld.inc
SET SESSION debug_dbug="-d,ib_discard_before_commit_crash";
DROP TABLE test_wl5522.t1;
#### Before DISCARD commit crash
##### After DISCARD commit crash
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET SESSION debug_dbug="+d,ib_discard_after_commit_crash";
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
INSERT INTO test_wl5522.t1 VALUES(1),(2),(3);
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Execute the statement that causes the crash
--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;
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
--source include/start_mysqld.inc
SET SESSION debug_dbug="-d,ib_discard_after_commit_crash";
DROP TABLE test_wl5522.t1;
#### After DISCARD commit crash
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
......@@ -116,61 +100,35 @@ do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
##### Before commit crash
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
--error ER_TABLESPACE_DISCARDED
SELECT * FROM test_wl5522.t1;
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Execute the statement that causes the crash
--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;
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
SET SESSION debug_dbug="-d,ib_import_before_commit_crash";
#### Before commit crash
--source include/start_mysqld.inc
# Check that the DD is consistent after recovery
##### Before checkpoint crash
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Don't start up the server right away.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Execute the statement that causes the crash
--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.
-- source include/wait_until_disconnected.inc
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
--echo # Restart and reconnect to the server
--enable_reconnect
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--disable_reconnect
SET SESSION debug_dbug="-d,ib_import_before_checkpoint_crash";
#### Before checkpoint crash
# After the above test the results are non-deterministic, recreate the table
# and do a proper import.
--source include/start_mysqld.inc
DROP TABLE test_wl5522.t1;
......@@ -202,6 +160,7 @@ DROP TABLE test_wl5522.t1;
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/
......@@ -210,7 +169,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_1";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -226,7 +185,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_2";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -241,7 +200,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_3";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -256,7 +215,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_4";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -271,7 +230,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_5";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -287,7 +246,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_6";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -303,7 +262,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_7";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -319,7 +278,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_8";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -334,7 +293,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_9";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -350,7 +309,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_10";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -366,7 +325,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_11";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -382,7 +341,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_12";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -422,7 +381,7 @@ EOF
--error ER_IO_READ_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_io_read_error_1";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -446,7 +405,7 @@ EOF
--error ER_IO_READ_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_io_read_error_2";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -470,7 +429,7 @@ EOF
--error ER_IO_READ_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_io_read_error_3";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -494,7 +453,7 @@ EOF
--error ER_IO_READ_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_io_read_error_4";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -518,7 +477,7 @@ EOF
--error ER_IO_READ_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_io_read_error_5";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -542,7 +501,7 @@ EOF
--error ER_IO_READ_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_io_read_error_6";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -566,7 +525,7 @@ EOF
--error ER_IO_READ_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_io_read_error_7";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -590,7 +549,7 @@ EOF
--error ER_IO_READ_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_io_read_error_8";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -614,7 +573,7 @@ EOF
--error ER_IO_READ_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_io_read_error_9";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -639,7 +598,7 @@ EOF
--error ER_IO_READ_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_string_read_error";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -666,7 +625,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_1";
--error ER_OUT_OF_RESOURCES
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_OOM_1";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -698,7 +657,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_2";
--error ER_OUT_OF_RESOURCES
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_OOM_2";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -730,7 +689,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_4";
--error ER_OUT_OF_RESOURCES
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_OOM_4";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -762,7 +721,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_5";
--error ER_OUT_OF_RESOURCES
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_OOM_5";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -793,7 +752,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_6";
--error ER_OUT_OF_RESOURCES
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_OOM_6";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -823,7 +782,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_7";
--error ER_OUT_OF_RESOURCES
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_OOM_7";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -853,7 +812,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_8";
--error ER_OUT_OF_RESOURCES
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_OOM_8";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -883,7 +842,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_9";
--error ER_OUT_OF_RESOURCES
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_OOM_9";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -913,7 +872,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_10";
--error ER_OUT_OF_RESOURCES
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_OOM_10";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -945,7 +904,7 @@ SET SESSION debug_dbug="+d,ib_import_internal_error";
--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_internal_error";
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
......@@ -986,7 +945,7 @@ do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
# Test failure after attempting a tablespace open
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
......@@ -996,7 +955,7 @@ SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
--error ER_GET_ERRMSG
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_open_tablespace_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
......@@ -1011,7 +970,7 @@ SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure";
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_check_bitmap_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
......@@ -1025,7 +984,7 @@ 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="-d,ib_import_cluster_root_adjust_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
......@@ -1039,7 +998,7 @@ SET SESSION debug_dbug="+d,ib_import_cluster_failure";
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_cluster_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
......@@ -1053,7 +1012,7 @@ 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="-d,ib_import_sec_root_adjust_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
......@@ -1067,7 +1026,7 @@ SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure";
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_set_max_rowid_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
# Left over from the failed IMPORT
perl;
......@@ -1250,7 +1209,7 @@ SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1";
--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_1";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -1274,14 +1233,14 @@ do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug_dbug="+d,buf_page_is_corrupt_failure";
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="-d,buf_page_is_corrupt_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -1311,7 +1270,7 @@ SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2";
--error ER_INNODB_INDEX_CORRUPT
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_2";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -1341,7 +1300,7 @@ SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3";
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_3";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -1361,7 +1320,7 @@ SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
SET SESSION debug_dbug="-d,ib_import_create_index_failure_1";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -1392,7 +1351,7 @@ SET SESSION debug_dbug="+d,fil_space_create_failure";
--error ER_GET_ERRMSG
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,fil_space_create_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -1423,7 +1382,7 @@ SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
--error ER_GET_ERRMSG
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,dict_tf_to_fsp_flags_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......@@ -1454,7 +1413,7 @@ SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure";
--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,fsp_flags_is_valid_failure";
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
......
......@@ -4,6 +4,7 @@
-- source include/have_innodb.inc
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it");
FLUSH TABLES;
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
......@@ -30,15 +31,18 @@ INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t1;
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT;
--list_files $MYSQLD_DATADIR/test
--echo # Restarting server
-- source include/restart_mysqld.inc
--echo # Done restarting server
FLUSH TABLE t1 FOR EXPORT;
--source include/restart_mysqld.inc
FLUSH TABLE t1, t2 FOR EXPORT;
--echo # List before copying files
--list_files $MYSQLD_DATADIR/test
--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd
--move_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_TMPDIR/t2.cfg
--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_TMPDIR/t2.ibd
UNLOCK TABLES;
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t1;
......@@ -64,10 +68,27 @@ SELECT COUNT(*) FROM t1;
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
DROP TABLE t1;
--remove_file $MYSQLD_TMPDIR/t1.cfg
--remove_file $MYSQLD_TMPDIR/t1.ibd
ALTER TABLE t2 ROW_FORMAT=DYNAMIC;
ALTER TABLE t2 DISCARD TABLESPACE;
--echo # List after t2 DISCARD
--list_files $MYSQLD_DATADIR/test
--move_file $MYSQLD_TMPDIR/t2.ibd $MYSQLD_DATADIR/test/t2.ibd
--move_file $MYSQLD_TMPDIR/t2.cfg $MYSQLD_DATADIR/test/t2.cfg
--error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t2 IMPORT TABLESPACE;
--remove_file $MYSQLD_DATADIR/test/t2.cfg
--replace_regex /(FSP_SPACE_FLAGS=0x)[0-9a-f]+(,.*0x)[0-9a-f]+(.*)/\1*\2*\3/
--error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t2 IMPORT TABLESPACE;
DROP TABLE t2;
--remove_file $MYSQLD_DATADIR/test/t2.ibd
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
let MYSQLD_DATADIR =`SELECT @@datadir`;
# Try importing when tablespace already exists
......
......@@ -122,7 +122,7 @@ c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
ROW_FORMAT=COMPRESSED;
SET GLOBAL INNODB_PURGE_STOP_NOW=ON;
SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
......@@ -166,7 +166,7 @@ t1 CREATE TABLE `t1` (
KEY `idx1` (`c2`),
KEY `idx2` (`c3`(512)),
KEY `idx3` (`c4`(512))
) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8
) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
SELECT c1, c2 FROM test_wl5522.t1;
c1 c2
2 32
......@@ -298,7 +298,7 @@ c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
ROW_FORMAT=COMPRESSED;
SELECT c1, c2 FROM test_wl5522.t1;
c1 c2
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
......@@ -422,7 +422,7 @@ t1 CREATE TABLE `t1` (
KEY `idx1` (`c2`),
KEY `idx2` (`c3`(512)),
KEY `idx3` (`c4`(512))
) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8
) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
......@@ -464,7 +464,7 @@ ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,buf_page_is_corrupt_failure";
SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
SET SESSION debug_dbug=@saved_debug_dbug;
......
......@@ -187,7 +187,7 @@ DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
ROW_FORMAT=COMPRESSED;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
......@@ -208,7 +208,7 @@ DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
......@@ -404,7 +404,7 @@ DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
......
# Not supported in embedded
# mysql-test-run.pl --embedded cannot restart the server.
--source include/not_embedded.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.
# Valgrind can hang or return spurious messages on DBUG_SUICIDE
--source include/not_valgrind.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
-- source include/have_innodb.inc
# compressed table in tests are with sizes KEY_BLOCK_SIZE 1,2,4,8,16
# Table creatation fails if KEY_BLOCK_SIZE > innodb-page-size,so
# allow test to run only when innodb-page-size=16
--source include/have_innodb_16k.inc
-- source include/have_innodb_zip.inc
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue.");
......@@ -41,7 +37,7 @@ INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_backup_tablespaces("test_wl5522", "t1");
EOF
UNLOCK TABLES;
......@@ -55,7 +51,7 @@ INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_discard_tablespaces("test_wl5522", "t1");
EOF
......@@ -64,7 +60,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -107,7 +103,7 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
# recreate the table and do a proper import.
-- source include/wait_until_disconnected.inc
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
......@@ -132,7 +128,7 @@ ROW_FORMAT=COMPRESSED;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -158,7 +154,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -175,7 +171,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -195,7 +191,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -209,7 +205,7 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -226,7 +222,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -241,7 +237,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -255,7 +251,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -269,7 +265,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -283,7 +279,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -297,7 +293,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Left over from the failed IMPORT
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
......@@ -323,7 +319,7 @@ CREATE TABLE test_wl5522.t1 (
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
ROW_FORMAT=COMPRESSED;
# Stop purge so that it doesn't remove the delete marked entries.
SET GLOBAL INNODB_PURGE_STOP_NOW=ON;
......@@ -379,7 +375,7 @@ SELECT name
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_backup_tablespaces("test_wl5522", "t1");
EOF
......@@ -408,14 +404,14 @@ CREATE TABLE test_wl5522.t1 (
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
ROW_FORMAT=COMPRESSED;
SELECT c1, c2 FROM test_wl5522.t1;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -451,7 +447,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_backup_tablespaces("test_wl5522", "t1");
EOF
......@@ -469,7 +465,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -485,7 +481,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
......@@ -501,11 +497,11 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug_dbug="+d,buf_page_is_corrupt_failure";
SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
......@@ -518,7 +514,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
......@@ -532,7 +528,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -548,7 +544,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
......@@ -562,7 +558,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -578,7 +574,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
......@@ -599,7 +595,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
......@@ -615,7 +611,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -630,7 +626,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
......@@ -646,7 +642,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -661,7 +657,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
......@@ -677,7 +673,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
......@@ -693,7 +689,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
......
......@@ -2,10 +2,7 @@
--source include/not_embedded.inc
-- source include/have_innodb.inc
# compressed table in tests are with sizes KEY_BLOCK_SIZE 1,2,4,8,16
# Table creatation fails if KEY_BLOCK_SIZE > innodb-page-size,so
# allow test to run only when innodb-page-size=16
--source include/have_innodb_16k.inc
-- source include/have_innodb_zip.inc
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
......@@ -104,7 +101,7 @@ INSERT INTO t1(c2) SELECT c2 FROM t1;
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
EOF
......@@ -123,7 +120,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
......@@ -154,7 +151,7 @@ INSERT INTO t1(c2) SELECT c2 FROM t1;
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
EOF
--list_files $MYSQLD_DATADIR/test
......@@ -177,7 +174,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
......@@ -197,7 +194,7 @@ DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
ROW_FORMAT=COMPRESSED;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
......@@ -208,7 +205,7 @@ INSERT INTO t1(c2) SELECT c2 FROM t1;
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1 WHERE c2 = 1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
EOF
--list_files $MYSQLD_DATADIR/test
......@@ -223,14 +220,14 @@ DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
......@@ -247,10 +244,12 @@ DROP TABLE t1;
# table and restore, this time the table has a secondary index too.
# Rename the index on the create so that the IMPORT fails, drop index
# Create with proper name and then do an IMPORT.
CREATE TABLE t1(
let $KEY_BLOCK_SIZE=`SELECT CONCAT('KEY_BLOCK_SIZE=', FLOOR(@@innodb_page_size/1024))`;
--replace_result $KEY_BLOCK_SIZE KEY_BLOCK_SIZE=16
eval CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
ROW_FORMAT=COMPRESSED $KEY_BLOCK_SIZE;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
......@@ -261,7 +260,7 @@ INSERT INTO t1(c2) SELECT c2 FROM t1;
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1 WHERE c2 = 1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
......@@ -272,17 +271,18 @@ INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE t1;
CREATE TABLE t1(
--replace_result $KEY_BLOCK_SIZE KEY_BLOCK_SIZE=16
eval CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX x(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
ROW_FORMAT=COMPRESSED $KEY_BLOCK_SIZE;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
......@@ -295,7 +295,7 @@ ALTER TABLE t1 DROP INDEX x;
ALTER TABLE t1 ADD INDEX idx(c2);
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test", "t1");
EOF
......@@ -305,7 +305,7 @@ CHECK TABLE t1;
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_cleanup("test", "t1");
EOF
......@@ -361,7 +361,7 @@ SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
EOF
......@@ -380,7 +380,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
......@@ -390,7 +390,7 @@ EOF
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test", "t1");
EOF
......@@ -408,7 +408,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
......@@ -418,7 +418,7 @@ EOF
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test", "t1");
EOF
......@@ -435,7 +435,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
......@@ -445,7 +445,7 @@ EOF
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test", "t1");
EOF
......@@ -455,27 +455,27 @@ DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
# This should fail because is KEY_BLOCK_SIZE=4
# but KEY_BLOCK_SIZE=8 is exported table
# This should fail because KEY_BLOCK_SIZE=1
# does not match the implicit KEY_BLOCK_SIZE of the exported table.
# Need better error message for following
--replace_regex /\(.*\)//
-- error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_unlink_tablespace("test", "t1");
EOF
......@@ -493,7 +493,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
......@@ -502,7 +502,7 @@ ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_cleanup("test", "t1");
EOF
......
......@@ -872,8 +872,7 @@ buf_page_is_corrupted(
}
#endif
DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); );
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(TRUE); );
if (!no_checksum && !page_size.is_compressed()
&& memcmp(read_buf + FIL_PAGE_LSN + 4,
......@@ -1002,7 +1001,6 @@ buf_page_is_corrupted(
read_buf + FIL_PAGE_OFFSET));
#endif /* UNIV_INNOCHECKSUM */
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(TRUE); );
const srv_checksum_algorithm_t curr_algo =
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
......@@ -6033,29 +6031,17 @@ buf_page_io_complete(
/* Not a real corruption if it was triggered by
error injection */
DBUG_EXECUTE_IF("buf_page_is_corrupt_failure",
if (bpage->id.space() != TRX_SYS_SPACE
&& buf_mark_space_corrupt(bpage)) {
ib::info() <<
"Simulated page corruption";
return(true);
}
goto page_not_corrupt_1;
;);
/* Not a real corruption if it was triggered by
error injection */
DBUG_EXECUTE_IF(
"buf_page_import_corrupt_failure",
if (bpage->id.space() > TRX_SYS_SPACE
&& !Tablespace::is_undo_tablespace(
bpage->id.space())
if (bpage->id.space()
> srv_undo_tablespaces_open
&& bpage->id.space() != SRV_TMP_SPACE_ID
&& buf_mark_space_corrupt(bpage)) {
ib::info() << "Simulated IMPORT "
"corruption";
return(true);
}
goto page_not_corrupt;
;);
goto page_not_corrupt;);
database_corrupted:
bool corrupted = buf_page_check_corrupt(bpage);
......@@ -6125,9 +6111,6 @@ buf_page_io_complete(
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure",
page_not_corrupt: bpage = bpage; );
DBUG_EXECUTE_IF("buf_page_is_corrupt_failure",
page_not_corrupt_1: bpage = bpage; );
if (recv_recovery_is_on()) {
/* Pages must be uncompressed for crash recovery. */
ut_a(uncompressed);
......@@ -6138,8 +6121,9 @@ buf_page_io_complete(
During re-init we have already freed ibuf entries. */
if (uncompressed
&& !recv_no_ibuf_operations
&& !Tablespace::is_undo_tablespace(bpage->id.space())
&& bpage->id.space() != SRV_TMP_SPACE_ID
&& (bpage->id.space() == 0
|| (bpage->id.space() > srv_undo_tablespaces_open
&& bpage->id.space() != SRV_TMP_SPACE_ID))
&& !srv_is_tablespace_truncated(bpage->id.space())
&& fil_page_get_type(frame) == FIL_PAGE_INDEX
&& page_is_leaf(frame)) {
......
......@@ -474,16 +474,11 @@ dict_build_tablespace_for_table(
return(DB_ERROR);
}
} else {
if (dict_table_is_temporary(table)) {
/* Use the shared temporary tablespace.
Note: The temp tablespace supports all non-Compressed
row formats whereas the system tablespace only
supports Redundant and Compact */
ut_ad(dict_tf_get_rec_format(table->flags)
!= REC_FORMAT_COMPRESSED);
if (dict_table_is_temporary(table)) {
table->space = SRV_TMP_SPACE_ID;
} else {
/* Create in the system tablespace. */
ut_ad(table->space == srv_sys_space.space_id());
}
......
......@@ -1186,9 +1186,8 @@ fil_space_extend_must_retry(
fil_flush_low(space);
return(false);
default:
// TODO: reject CREATE TEMPORARY TABLE...ROW_FORMAT=COMPRESSED
ut_ad(space->purpose == FIL_TYPE_TABLESPACE
|| space->purpose == FIL_TYPE_TEMPORARY);
|| space->purpose == FIL_TYPE_IMPORT);
if (space->purpose == FIL_TYPE_TABLESPACE) {
fil_flush_low(space);
}
......
......@@ -12174,7 +12174,7 @@ create_table_info_t::create_option_data_directory_is_valid()
}
/** Validate the create options. Check that the options KEY_BLOCK_SIZE,
ROW_FORMAT, DATA DIRECTORY, TEMPORARY & TABLESPACE are compatible with
ROW_FORMAT, DATA DIRECTORY, TEMPORARY are compatible with
each other and other settings. These CREATE OPTIONS are not validated
here unless innodb_strict_mode is on. With strict mode, this function
will report each problem it finds using a custom message with error
......
......@@ -200,13 +200,6 @@ class Tablespace {
ut_a(!m_files.empty());
return(&m_files.front());
}
/** Check if undo tablespace.
@return true if undo tablespace */
static bool is_undo_tablespace(ulint id)
{
return(id <= srv_undo_tablespaces_open);
}
private:
/**
@param[in] filename Name to lookup in the data files.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment