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 ...@@ -42,5 +42,3 @@ galera_sst_xtrabackup-v2 : MDEV-11208
galera_sst_xtrabackup-v2_encrypt_with_key : MDEV-11208 galera_sst_xtrabackup-v2_encrypt_with_key : MDEV-11208
mysql-wsrep#33 : TODO: investigate mysql-wsrep#33 : TODO: investigate
galera_var_innodb_disallow_writes : MDEV-10949 galera_var_innodb_disallow_writes : MDEV-10949
galera_many_tables_pk : MDEV-11927
galera_many_tables_nopk : MDEV-11927
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT."); 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; FLUSH TABLES;
CREATE TABLE t1 CREATE TABLE t1
(a INT AUTO_INCREMENT PRIMARY KEY, (a INT AUTO_INCREMENT PRIMARY KEY,
...@@ -29,15 +30,19 @@ a b c ...@@ -29,15 +30,19 @@ a b c
823 Evolution lsjndofiabsoibeg 823 Evolution lsjndofiabsoibeg
822 Devotion asdfuihknaskdf 822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf 821 Cavalry ..asdasdfaeraf
CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT;
t1.frm t1.frm
t1.ibd t1.ibd
# Restarting server t2.frm
# Done restarting server t2.ibd
FLUSH TABLE t1 FOR EXPORT; FLUSH TABLE t1, t2 FOR EXPORT;
# List before copying files # List before copying files
t1.cfg t1.cfg
t1.frm t1.frm
t1.ibd t1.ibd
t2.cfg
t2.frm
t2.ibd
UNLOCK TABLES; UNLOCK TABLES;
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
...@@ -58,9 +63,13 @@ a b c ...@@ -58,9 +63,13 @@ a b c
# List before t1 DISCARD # List before t1 DISCARD
t1.frm t1.frm
t1.ibd t1.ibd
t2.frm
t2.ibd
ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t1 DISCARD TABLESPACE;
# List after t1 DISCARD # List after t1 DISCARD
t1.frm t1.frm
t2.frm
t2.ibd
ALTER TABLE t1 IMPORT TABLESPACE; ALTER TABLE t1 IMPORT TABLESPACE;
ALTER TABLE t1 ENGINE InnoDB; ALTER TABLE t1 ENGINE InnoDB;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
...@@ -79,6 +88,8 @@ a b c ...@@ -79,6 +88,8 @@ a b c
t1.cfg t1.cfg
t1.frm t1.frm
t1.ibd t1.ibd
t2.frm
t2.ibd
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
640 640
...@@ -93,6 +104,19 @@ a b c ...@@ -93,6 +104,19 @@ a b c
822 Devotion asdfuihknaskdf 822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf 821 Cavalry ..asdasdfaeraf
DROP TABLE t1; 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( CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB; c2 INT) ENGINE=InnoDB;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
-- source include/have_innodb.inc -- 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("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; FLUSH TABLES;
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`; let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
...@@ -30,15 +31,18 @@ INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; ...@@ -30,15 +31,18 @@ INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
SELECT * FROM t1 ORDER BY 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 --list_files $MYSQLD_DATADIR/test
--echo # Restarting server --source include/restart_mysqld.inc
-- source include/restart_mysqld.inc FLUSH TABLE t1, t2 FOR EXPORT;
--echo # Done restarting server
FLUSH TABLE t1 FOR EXPORT;
--echo # List before copying files --echo # List before copying files
--list_files $MYSQLD_DATADIR/test --list_files $MYSQLD_DATADIR/test
--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg --copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd --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; UNLOCK TABLES;
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
...@@ -64,10 +68,27 @@ 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 b,a DESC LIMIT 3;
SELECT * FROM t1 ORDER BY a DESC LIMIT 3; SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_TMPDIR/t1.cfg --remove_file $MYSQLD_TMPDIR/t1.cfg
--remove_file $MYSQLD_TMPDIR/t1.ibd --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`; let MYSQLD_DATADIR =`SELECT @@datadir`;
# Try importing when tablespace already exists # Try importing when tablespace already exists
......
...@@ -122,7 +122,7 @@ c4 VARCHAR(2048), ...@@ -122,7 +122,7 @@ c4 VARCHAR(2048),
INDEX idx1(c2), INDEX idx1(c2),
INDEX idx2(c3(512)), INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB 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_PURGE_STOP_NOW=ON;
SET GLOBAL innodb_disable_background_merge=ON; SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges; SET GLOBAL innodb_monitor_reset = ibuf_merges;
...@@ -166,7 +166,7 @@ t1 CREATE TABLE `t1` ( ...@@ -166,7 +166,7 @@ t1 CREATE TABLE `t1` (
KEY `idx1` (`c2`), KEY `idx1` (`c2`),
KEY `idx2` (`c3`(512)), KEY `idx2` (`c3`(512)),
KEY `idx3` (`c4`(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; SELECT c1, c2 FROM test_wl5522.t1;
c1 c2 c1 c2
2 32 2 32
...@@ -298,7 +298,7 @@ c4 VARCHAR(2048), ...@@ -298,7 +298,7 @@ c4 VARCHAR(2048),
INDEX idx1(c2), INDEX idx1(c2),
INDEX idx2(c3(512)), INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; ROW_FORMAT=COMPRESSED;
SELECT c1, c2 FROM test_wl5522.t1; SELECT c1, c2 FROM test_wl5522.t1;
c1 c2 c1 c2
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
...@@ -422,7 +422,7 @@ t1 CREATE TABLE `t1` ( ...@@ -422,7 +422,7 @@ t1 CREATE TABLE `t1` (
KEY `idx1` (`c2`), KEY `idx1` (`c2`),
KEY `idx2` (`c3`(512)), KEY `idx2` (`c3`(512)),
KEY `idx3` (`c4`(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; DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
...@@ -464,7 +464,7 @@ ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; ...@@ -464,7 +464,7 @@ ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1; SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table `t1` ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files 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; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
SET SESSION debug_dbug=@saved_debug_dbug; SET SESSION debug_dbug=@saved_debug_dbug;
......
...@@ -187,7 +187,7 @@ DROP TABLE t1; ...@@ -187,7 +187,7 @@ DROP TABLE t1;
CREATE TABLE t1( CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB 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) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1; INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1; INSERT INTO t1(c2) SELECT c2 FROM t1;
...@@ -208,7 +208,7 @@ DROP TABLE t1; ...@@ -208,7 +208,7 @@ DROP TABLE t1;
CREATE TABLE t1( CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB c2 INT, INDEX(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1; SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1` ERROR HY000: Tablespace has been discarded for table `t1`
...@@ -404,7 +404,7 @@ DROP TABLE t1; ...@@ -404,7 +404,7 @@ DROP TABLE t1;
CREATE TABLE t1( CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB 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; ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1; SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `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 --source include/not_embedded.inc
# This test case needs to crash the server. Needs a debug server. # This test case needs to crash the server. Needs a debug server.
--source include/have_debug.inc --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 --source include/not_valgrind.inc
# Avoid CrashReporter popup on Mac # Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc --source include/not_crashrep.inc
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_innodb_zip.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
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); 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."); 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); ...@@ -41,7 +37,7 @@ INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
FLUSH TABLES test_wl5522.t1 FOR EXPORT; FLUSH TABLES test_wl5522.t1 FOR EXPORT;
perl; 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"); ib_backup_tablespaces("test_wl5522", "t1");
EOF EOF
UNLOCK TABLES; UNLOCK TABLES;
...@@ -55,7 +51,7 @@ INSERT INTO test_wl5522.t1 VALUES (1); ...@@ -55,7 +51,7 @@ INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
perl; 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"); ib_discard_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -64,7 +60,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; ...@@ -64,7 +60,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -107,7 +103,7 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ...@@ -107,7 +103,7 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
# recreate the table and do a proper import. # recreate the table and do a proper import.
-- source include/wait_until_disconnected.inc -- source include/wait_until_disconnected.inc
perl; 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"); ib_unlink_tablespace("test_wl5522", "t1");
EOF EOF
...@@ -132,7 +128,7 @@ ROW_FORMAT=COMPRESSED; ...@@ -132,7 +128,7 @@ ROW_FORMAT=COMPRESSED;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -158,7 +154,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; ...@@ -158,7 +154,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -175,7 +171,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -175,7 +171,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -195,7 +191,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; ...@@ -195,7 +191,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -209,7 +205,7 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ...@@ -209,7 +205,7 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -226,7 +222,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -226,7 +222,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -241,7 +237,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -241,7 +237,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -255,7 +251,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -255,7 +251,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -269,7 +265,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -269,7 +265,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -283,7 +279,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -283,7 +279,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -297,7 +293,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -297,7 +293,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Left over from the failed IMPORT # Left over from the failed IMPORT
perl; 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"); ib_unlink_tablespace("test_wl5522", "t1");
EOF EOF
...@@ -323,7 +319,7 @@ CREATE TABLE test_wl5522.t1 ( ...@@ -323,7 +319,7 @@ CREATE TABLE test_wl5522.t1 (
INDEX idx1(c2), INDEX idx1(c2),
INDEX idx2(c3(512)), INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB 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. # Stop purge so that it doesn't remove the delete marked entries.
SET GLOBAL INNODB_PURGE_STOP_NOW=ON; SET GLOBAL INNODB_PURGE_STOP_NOW=ON;
...@@ -379,7 +375,7 @@ SELECT name ...@@ -379,7 +375,7 @@ SELECT name
FLUSH TABLES test_wl5522.t1 FOR EXPORT; FLUSH TABLES test_wl5522.t1 FOR EXPORT;
perl; 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"); ib_backup_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -408,14 +404,14 @@ CREATE TABLE test_wl5522.t1 ( ...@@ -408,14 +404,14 @@ CREATE TABLE test_wl5522.t1 (
INDEX idx1(c2), INDEX idx1(c2),
INDEX idx2(c3(512)), INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; ROW_FORMAT=COMPRESSED;
SELECT c1, c2 FROM test_wl5522.t1; SELECT c1, c2 FROM test_wl5522.t1;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -451,7 +447,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; ...@@ -451,7 +447,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
FLUSH TABLES test_wl5522.t1 FOR EXPORT; FLUSH TABLES test_wl5522.t1 FOR EXPORT;
perl; 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"); ib_backup_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -469,7 +465,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; ...@@ -469,7 +465,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -485,7 +481,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -485,7 +481,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1; DROP TABLE test_wl5522.t1;
perl; 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"); ib_unlink_tablespace("test_wl5522", "t1");
EOF EOF
...@@ -501,11 +497,11 @@ SELECT COUNT(*) FROM test_wl5522.t1; ...@@ -501,11 +497,11 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF 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'/ --replace_regex /'.*t1.cfg'/'t1.cfg'/
...@@ -518,7 +514,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -518,7 +514,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1; DROP TABLE test_wl5522.t1;
perl; 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"); ib_unlink_tablespace("test_wl5522", "t1");
EOF EOF
...@@ -532,7 +528,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; ...@@ -532,7 +528,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -548,7 +544,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -548,7 +544,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1; DROP TABLE test_wl5522.t1;
perl; 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"); ib_unlink_tablespace("test_wl5522", "t1");
EOF EOF
...@@ -562,7 +558,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; ...@@ -562,7 +558,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -578,7 +574,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -578,7 +574,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1; DROP TABLE test_wl5522.t1;
perl; 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"); ib_unlink_tablespace("test_wl5522", "t1");
EOF EOF
...@@ -599,7 +595,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -599,7 +595,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1; DROP TABLE test_wl5522.t1;
perl; 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"); ib_unlink_tablespace("test_wl5522", "t1");
EOF EOF
...@@ -615,7 +611,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; ...@@ -615,7 +611,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -630,7 +626,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -630,7 +626,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1; DROP TABLE test_wl5522.t1;
perl; 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"); ib_unlink_tablespace("test_wl5522", "t1");
EOF EOF
...@@ -646,7 +642,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; ...@@ -646,7 +642,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -661,7 +657,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -661,7 +657,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1; DROP TABLE test_wl5522.t1;
perl; 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"); ib_unlink_tablespace("test_wl5522", "t1");
EOF EOF
...@@ -677,7 +673,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; ...@@ -677,7 +673,7 @@ SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files # Restore files
perl; 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"); ib_restore_tablespaces("test_wl5522", "t1");
EOF EOF
...@@ -693,7 +689,7 @@ SET SESSION debug_dbug=@saved_debug_dbug; ...@@ -693,7 +689,7 @@ SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE test_wl5522.t1; DROP TABLE test_wl5522.t1;
perl; 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"); ib_unlink_tablespace("test_wl5522", "t1");
EOF EOF
......
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
--source include/not_embedded.inc --source include/not_embedded.inc
-- source include/have_innodb.inc -- source include/have_innodb.inc
# compressed table in tests are with sizes KEY_BLOCK_SIZE 1,2,4,8,16 -- source include/have_innodb_zip.inc
# 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
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT."); 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; ...@@ -104,7 +101,7 @@ INSERT INTO t1(c2) SELECT c2 FROM t1;
FLUSH TABLES t1 FOR EXPORT; FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
perl; 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"); ib_backup_tablespaces("test", "t1");
EOF EOF
...@@ -123,7 +120,7 @@ ALTER TABLE t1 DISCARD TABLESPACE; ...@@ -123,7 +120,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1; SELECT * FROM t1;
perl; 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_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1"); ib_restore_tablespaces("test", "t1");
EOF EOF
...@@ -154,7 +151,7 @@ INSERT INTO t1(c2) SELECT c2 FROM t1; ...@@ -154,7 +151,7 @@ INSERT INTO t1(c2) SELECT c2 FROM t1;
FLUSH TABLES t1 FOR EXPORT; FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
perl; 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"); ib_backup_tablespaces("test", "t1");
EOF EOF
--list_files $MYSQLD_DATADIR/test --list_files $MYSQLD_DATADIR/test
...@@ -177,7 +174,7 @@ ALTER TABLE t1 DISCARD TABLESPACE; ...@@ -177,7 +174,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1; SELECT * FROM t1;
perl; 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_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1"); ib_restore_tablespaces("test", "t1");
EOF EOF
...@@ -197,7 +194,7 @@ DROP TABLE t1; ...@@ -197,7 +194,7 @@ DROP TABLE t1;
CREATE TABLE t1( CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB 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) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1; INSERT INTO t1(c2) SELECT c2 FROM t1;
...@@ -208,7 +205,7 @@ 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; FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1 WHERE c2 = 1; SELECT COUNT(*) FROM t1 WHERE c2 = 1;
perl; 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"); ib_backup_tablespaces("test", "t1");
EOF EOF
--list_files $MYSQLD_DATADIR/test --list_files $MYSQLD_DATADIR/test
...@@ -223,14 +220,14 @@ DROP TABLE t1; ...@@ -223,14 +220,14 @@ DROP TABLE t1;
CREATE TABLE t1( CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB c2 INT, INDEX(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED --error ER_TABLESPACE_DISCARDED
SELECT * FROM t1; SELECT * FROM t1;
perl; 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_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1"); ib_restore_tablespaces("test", "t1");
EOF EOF
...@@ -247,10 +244,12 @@ DROP TABLE t1; ...@@ -247,10 +244,12 @@ DROP TABLE t1;
# table and restore, this time the table has a secondary index too. # 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 # Rename the index on the create so that the IMPORT fails, drop index
# Create with proper name and then do an IMPORT. # 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, c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB 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) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1; INSERT INTO t1(c2) SELECT c2 FROM t1;
...@@ -261,7 +260,7 @@ 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; FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1 WHERE c2 = 1; SELECT COUNT(*) FROM t1 WHERE c2 = 1;
perl; 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"); ib_backup_tablespaces("test", "t1");
EOF EOF
UNLOCK TABLES; UNLOCK TABLES;
...@@ -272,17 +271,18 @@ INSERT INTO t1(c2) SELECT c2 FROM t1; ...@@ -272,17 +271,18 @@ INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE 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, c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX x(c2)) ENGINE=InnoDB 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; ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED --error ER_TABLESPACE_DISCARDED
SELECT * FROM t1; SELECT * FROM t1;
perl; 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_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1"); ib_restore_tablespaces("test", "t1");
EOF EOF
...@@ -295,7 +295,7 @@ ALTER TABLE t1 DROP INDEX x; ...@@ -295,7 +295,7 @@ ALTER TABLE t1 DROP INDEX x;
ALTER TABLE t1 ADD INDEX idx(c2); ALTER TABLE t1 ADD INDEX idx(c2);
perl; 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"); ib_restore_tablespaces("test", "t1");
EOF EOF
...@@ -305,7 +305,7 @@ CHECK TABLE t1; ...@@ -305,7 +305,7 @@ CHECK TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
perl; perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_cleanup("test", "t1"); ib_cleanup("test", "t1");
EOF EOF
...@@ -361,7 +361,7 @@ SELECT * FROM t1; ...@@ -361,7 +361,7 @@ SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT; FLUSH TABLES t1 FOR EXPORT;
perl; 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"); ib_backup_tablespaces("test", "t1");
EOF EOF
...@@ -380,7 +380,7 @@ ALTER TABLE t1 DISCARD TABLESPACE; ...@@ -380,7 +380,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1; SELECT * FROM t1;
perl; 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_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1"); ib_restore_tablespaces("test", "t1");
EOF EOF
...@@ -390,7 +390,7 @@ EOF ...@@ -390,7 +390,7 @@ EOF
ALTER TABLE t1 IMPORT TABLESPACE; ALTER TABLE t1 IMPORT TABLESPACE;
perl; 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"); ib_unlink_tablespace("test", "t1");
EOF EOF
...@@ -408,7 +408,7 @@ ALTER TABLE t1 DISCARD TABLESPACE; ...@@ -408,7 +408,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1; SELECT * FROM t1;
perl; 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_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1"); ib_restore_tablespaces("test", "t1");
EOF EOF
...@@ -418,7 +418,7 @@ EOF ...@@ -418,7 +418,7 @@ EOF
ALTER TABLE t1 IMPORT TABLESPACE; ALTER TABLE t1 IMPORT TABLESPACE;
perl; 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"); ib_unlink_tablespace("test", "t1");
EOF EOF
...@@ -435,7 +435,7 @@ ALTER TABLE t1 DISCARD TABLESPACE; ...@@ -435,7 +435,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1; SELECT * FROM t1;
perl; 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_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1"); ib_restore_tablespaces("test", "t1");
EOF EOF
...@@ -445,7 +445,7 @@ EOF ...@@ -445,7 +445,7 @@ EOF
ALTER TABLE t1 IMPORT TABLESPACE; ALTER TABLE t1 IMPORT TABLESPACE;
perl; 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"); ib_unlink_tablespace("test", "t1");
EOF EOF
...@@ -455,27 +455,27 @@ DROP TABLE t1; ...@@ -455,27 +455,27 @@ DROP TABLE t1;
CREATE TABLE t1( CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB 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; ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED --error ER_TABLESPACE_DISCARDED
SELECT * FROM t1; SELECT * FROM t1;
perl; 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_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1"); ib_restore_tablespaces("test", "t1");
EOF EOF
# This should fail because is KEY_BLOCK_SIZE=4 # This should fail because KEY_BLOCK_SIZE=1
# but KEY_BLOCK_SIZE=8 is exported table # does not match the implicit KEY_BLOCK_SIZE of the exported table.
# Need better error message for following # Need better error message for following
--replace_regex /\(.*\)// --replace_regex /\(.*\)//
-- error ER_TABLE_SCHEMA_MISMATCH -- error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE; ALTER TABLE t1 IMPORT TABLESPACE;
perl; 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"); ib_unlink_tablespace("test", "t1");
EOF EOF
...@@ -493,7 +493,7 @@ ALTER TABLE t1 DISCARD TABLESPACE; ...@@ -493,7 +493,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1; SELECT * FROM t1;
perl; 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_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1"); ib_restore_tablespaces("test", "t1");
EOF EOF
...@@ -502,7 +502,7 @@ ALTER TABLE t1 IMPORT TABLESPACE; ...@@ -502,7 +502,7 @@ ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1; CHECK TABLE t1;
perl; perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_cleanup("test", "t1"); ib_cleanup("test", "t1");
EOF EOF
......
...@@ -872,8 +872,7 @@ buf_page_is_corrupted( ...@@ -872,8 +872,7 @@ buf_page_is_corrupted(
} }
#endif #endif
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(TRUE); );
DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); );
if (!no_checksum && !page_size.is_compressed() if (!no_checksum && !page_size.is_compressed()
&& memcmp(read_buf + FIL_PAGE_LSN + 4, && memcmp(read_buf + FIL_PAGE_LSN + 4,
...@@ -1002,7 +1001,6 @@ buf_page_is_corrupted( ...@@ -1002,7 +1001,6 @@ buf_page_is_corrupted(
read_buf + FIL_PAGE_OFFSET)); read_buf + FIL_PAGE_OFFSET));
#endif /* UNIV_INNOCHECKSUM */ #endif /* UNIV_INNOCHECKSUM */
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(TRUE); );
const srv_checksum_algorithm_t curr_algo = const srv_checksum_algorithm_t curr_algo =
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm); static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
...@@ -6033,29 +6031,17 @@ buf_page_io_complete( ...@@ -6033,29 +6031,17 @@ buf_page_io_complete(
/* Not a real corruption if it was triggered by /* Not a real corruption if it was triggered by
error injection */ 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( DBUG_EXECUTE_IF(
"buf_page_import_corrupt_failure", "buf_page_import_corrupt_failure",
if (bpage->id.space() > TRX_SYS_SPACE if (bpage->id.space()
&& !Tablespace::is_undo_tablespace( > srv_undo_tablespaces_open
bpage->id.space()) && bpage->id.space() != SRV_TMP_SPACE_ID
&& buf_mark_space_corrupt(bpage)) { && buf_mark_space_corrupt(bpage)) {
ib::info() << "Simulated IMPORT " ib::info() << "Simulated IMPORT "
"corruption"; "corruption";
return(true); return(true);
} }
goto page_not_corrupt; goto page_not_corrupt;);
;);
database_corrupted: database_corrupted:
bool corrupted = buf_page_check_corrupt(bpage); bool corrupted = buf_page_check_corrupt(bpage);
...@@ -6125,9 +6111,6 @@ buf_page_io_complete( ...@@ -6125,9 +6111,6 @@ buf_page_io_complete(
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", DBUG_EXECUTE_IF("buf_page_import_corrupt_failure",
page_not_corrupt: bpage = bpage; ); page_not_corrupt: bpage = bpage; );
DBUG_EXECUTE_IF("buf_page_is_corrupt_failure",
page_not_corrupt_1: bpage = bpage; );
if (recv_recovery_is_on()) { if (recv_recovery_is_on()) {
/* Pages must be uncompressed for crash recovery. */ /* Pages must be uncompressed for crash recovery. */
ut_a(uncompressed); ut_a(uncompressed);
...@@ -6138,8 +6121,9 @@ buf_page_io_complete( ...@@ -6138,8 +6121,9 @@ buf_page_io_complete(
During re-init we have already freed ibuf entries. */ During re-init we have already freed ibuf entries. */
if (uncompressed if (uncompressed
&& !recv_no_ibuf_operations && !recv_no_ibuf_operations
&& !Tablespace::is_undo_tablespace(bpage->id.space()) && (bpage->id.space() == 0
&& bpage->id.space() != SRV_TMP_SPACE_ID || (bpage->id.space() > srv_undo_tablespaces_open
&& bpage->id.space() != SRV_TMP_SPACE_ID))
&& !srv_is_tablespace_truncated(bpage->id.space()) && !srv_is_tablespace_truncated(bpage->id.space())
&& fil_page_get_type(frame) == FIL_PAGE_INDEX && fil_page_get_type(frame) == FIL_PAGE_INDEX
&& page_is_leaf(frame)) { && page_is_leaf(frame)) {
......
...@@ -474,16 +474,11 @@ dict_build_tablespace_for_table( ...@@ -474,16 +474,11 @@ dict_build_tablespace_for_table(
return(DB_ERROR); return(DB_ERROR);
} }
} else { } 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) ut_ad(dict_tf_get_rec_format(table->flags)
!= REC_FORMAT_COMPRESSED); != REC_FORMAT_COMPRESSED);
if (dict_table_is_temporary(table)) {
table->space = SRV_TMP_SPACE_ID; table->space = SRV_TMP_SPACE_ID;
} else { } else {
/* Create in the system tablespace. */
ut_ad(table->space == srv_sys_space.space_id()); ut_ad(table->space == srv_sys_space.space_id());
} }
......
...@@ -1186,9 +1186,8 @@ fil_space_extend_must_retry( ...@@ -1186,9 +1186,8 @@ fil_space_extend_must_retry(
fil_flush_low(space); fil_flush_low(space);
return(false); return(false);
default: default:
// TODO: reject CREATE TEMPORARY TABLE...ROW_FORMAT=COMPRESSED
ut_ad(space->purpose == FIL_TYPE_TABLESPACE ut_ad(space->purpose == FIL_TYPE_TABLESPACE
|| space->purpose == FIL_TYPE_TEMPORARY); || space->purpose == FIL_TYPE_IMPORT);
if (space->purpose == FIL_TYPE_TABLESPACE) { if (space->purpose == FIL_TYPE_TABLESPACE) {
fil_flush_low(space); fil_flush_low(space);
} }
......
...@@ -12174,7 +12174,7 @@ create_table_info_t::create_option_data_directory_is_valid() ...@@ -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, /** 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 each other and other settings. These CREATE OPTIONS are not validated
here unless innodb_strict_mode is on. With strict mode, this function here unless innodb_strict_mode is on. With strict mode, this function
will report each problem it finds using a custom message with error will report each problem it finds using a custom message with error
......
...@@ -200,13 +200,6 @@ class Tablespace { ...@@ -200,13 +200,6 @@ class Tablespace {
ut_a(!m_files.empty()); ut_a(!m_files.empty());
return(&m_files.front()); 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: private:
/** /**
@param[in] filename Name to lookup in the data files. @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