|
| 1 | +-- source include/have_innodb.inc |
| 2 | +-- source include/have_file_key_management_plugin.inc |
| 3 | +# embedded does not support restart |
| 4 | +-- source include/not_embedded.inc |
| 5 | +-- source include/not_valgrind.inc |
| 6 | +# Avoid CrashReporter popup on Mac |
| 7 | +-- source include/not_crashrep.inc |
| 8 | + |
| 9 | +# |
| 10 | +# MDEV-8770: Incorrect error message when importing page compressed tablespace |
| 11 | +# |
| 12 | + |
| 13 | +call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded"); |
| 14 | + |
| 15 | +--disable_query_log |
| 16 | +let $innodb_file_format_orig = `SELECT @@innodb_file_format`; |
| 17 | +let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; |
| 18 | +let $innodb_compression_algo = `SELECT @@innodb_compression_algorithm`; |
| 19 | +--enable_query_log |
| 20 | + |
| 21 | +SET GLOBAL innodb_file_format = `Barracuda`; |
| 22 | +SET GLOBAL innodb_file_per_table = ON; |
| 23 | +SET GLOBAL innodb_compression_algorithm = 1; |
| 24 | + |
| 25 | +--let $MYSQLD_TMPDIR = `SELECT @@tmpdir` |
| 26 | +--let $MYSQLD_DATADIR = `SELECT @@datadir` |
| 27 | +--let SEARCH_RANGE = 10000000 |
| 28 | +--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd |
| 29 | +--let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd |
| 30 | +--let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd |
| 31 | +--let t4_IBD = $MYSQLD_DATADIR/test/t4.ibd |
| 32 | + |
| 33 | +create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=4; |
| 34 | +show warnings; |
| 35 | +create table t2(c1 bigint not null, b char(200)) engine=innodb page_compressed=1 encrypted=yes encryption_key_id=4; |
| 36 | +show warnings; |
| 37 | +create table t3(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=4; |
| 38 | +show warnings; |
| 39 | +create table t4(c1 bigint not null, b char(200)) engine=innodb page_compressed=1; |
| 40 | +show warnings; |
| 41 | + |
| 42 | +delimiter //; |
| 43 | +create procedure innodb_insert_proc (repeat_count int) |
| 44 | +begin |
| 45 | + declare current_num int; |
| 46 | + set current_num = 0; |
| 47 | + while current_num < repeat_count do |
| 48 | + insert into t1 values(current_num, repeat('foobar',30)); |
| 49 | + insert into t2 values(current_num, repeat('barfoo',30)); |
| 50 | + insert into t3 values(current_num, repeat('tmpres',30)); |
| 51 | + insert into t4 values(current_num, repeat('mysql',30)); |
| 52 | + set current_num = current_num + 1; |
| 53 | + end while; |
| 54 | +end// |
| 55 | +delimiter ;// |
| 56 | +commit; |
| 57 | + |
| 58 | +set autocommit=0; |
| 59 | +call innodb_insert_proc(2000); |
| 60 | +commit; |
| 61 | +set autocommit=1; |
| 62 | + |
| 63 | +select count(*) from t1; |
| 64 | +select count(*) from t2; |
| 65 | +select count(*) from t3; |
| 66 | +select count(*) from t4; |
| 67 | + |
| 68 | +FLUSH TABLE t1,t2,t3,t4 FOR EXPORT; |
| 69 | +--echo # List before copying files |
| 70 | +--list_files $MYSQLD_DATADIR/test |
| 71 | +--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg |
| 72 | +--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd |
| 73 | +--copy_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_TMPDIR/t2.cfg |
| 74 | +--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_TMPDIR/t2.ibd |
| 75 | +--copy_file $MYSQLD_DATADIR/test/t3.cfg $MYSQLD_TMPDIR/t3.cfg |
| 76 | +--copy_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_TMPDIR/t3.ibd |
| 77 | +--copy_file $MYSQLD_DATADIR/test/t4.cfg $MYSQLD_TMPDIR/t4.cfg |
| 78 | +--copy_file $MYSQLD_DATADIR/test/t4.ibd $MYSQLD_TMPDIR/t4.ibd |
| 79 | +UNLOCK TABLES; |
| 80 | + |
| 81 | +--echo # tables should be either encrypted and/or compressed |
| 82 | +--let SEARCH_PATTERN=foobar |
| 83 | +--echo # t1 yes on expecting NOT FOUND |
| 84 | +-- let SEARCH_FILE=$t1_IBD |
| 85 | +-- source include/search_pattern_in_file.inc |
| 86 | +--let SEARCH_PATTERN=barfoo |
| 87 | +--echo # t2 yes on expecting NOT FOUND |
| 88 | +-- let SEARCH_FILE=$t2_IBD |
| 89 | +-- source include/search_pattern_in_file.inc |
| 90 | +--let SEARCH_PATTERN=tmpres |
| 91 | +--echo # t3 yes on expecting NOT FOUND |
| 92 | +-- let SEARCH_FILE=$t3_IBD |
| 93 | +-- source include/search_pattern_in_file.inc |
| 94 | +--let SEARCH_PATTERN=mysql |
| 95 | +--echo # t4 yes on expecting NOT FOUND |
| 96 | +-- let SEARCH_FILE=$t4_IBD |
| 97 | +-- source include/search_pattern_in_file.inc |
| 98 | + |
| 99 | +ALTER TABLE t1 DISCARD TABLESPACE; |
| 100 | +ALTER TABLE t2 DISCARD TABLESPACE; |
| 101 | +ALTER TABLE t3 DISCARD TABLESPACE; |
| 102 | +ALTER TABLE t4 DISCARD TABLESPACE; |
| 103 | + |
| 104 | +--source include/restart_mysqld.inc |
| 105 | + |
| 106 | +SET GLOBAL innodb_file_format = `Barracuda`; |
| 107 | +SET GLOBAL innodb_file_per_table = ON; |
| 108 | +SET GLOBAL innodb_compression_algorithm = 1; |
| 109 | + |
| 110 | +--echo # List after t1 DISCARD |
| 111 | +--list_files $MYSQLD_DATADIR/test |
| 112 | +--copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg |
| 113 | +--copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd |
| 114 | +--copy_file $MYSQLD_TMPDIR/t2.cfg $MYSQLD_DATADIR/test/t2.cfg |
| 115 | +--copy_file $MYSQLD_TMPDIR/t2.ibd $MYSQLD_DATADIR/test/t2.ibd |
| 116 | +--copy_file $MYSQLD_TMPDIR/t3.cfg $MYSQLD_DATADIR/test/t3.cfg |
| 117 | +--copy_file $MYSQLD_TMPDIR/t3.ibd $MYSQLD_DATADIR/test/t3.ibd |
| 118 | +--copy_file $MYSQLD_TMPDIR/t4.cfg $MYSQLD_DATADIR/test/t4.cfg |
| 119 | +--copy_file $MYSQLD_TMPDIR/t4.ibd $MYSQLD_DATADIR/test/t4.ibd |
| 120 | + |
| 121 | +ALTER TABLE t1 IMPORT TABLESPACE; |
| 122 | +SHOW CREATE TABLE t1; |
| 123 | +SELECT COUNT(*) FROM t1; |
| 124 | +ALTER TABLE t2 IMPORT TABLESPACE; |
| 125 | +SHOW CREATE TABLE t2; |
| 126 | +SELECT COUNT(*) FROM t2; |
| 127 | +ALTER TABLE t3 IMPORT TABLESPACE; |
| 128 | +SHOW CREATE TABLE t3; |
| 129 | +SELECT COUNT(*) FROM t3; |
| 130 | +ALTER TABLE t4 IMPORT TABLESPACE; |
| 131 | +SHOW CREATE TABLE t4; |
| 132 | +SELECT COUNT(*) FROM t4; |
| 133 | + |
| 134 | +--echo flush data to disk |
| 135 | +--source include/restart_mysqld.inc |
| 136 | + |
| 137 | +SET GLOBAL innodb_file_format = `Barracuda`; |
| 138 | +SET GLOBAL innodb_file_per_table = ON; |
| 139 | +SET GLOBAL innodb_compression_algorithm = 1; |
| 140 | + |
| 141 | +--echo # tables should be still either encrypted and/or compressed |
| 142 | +--let SEARCH_PATTERN=foobar |
| 143 | +--echo # t1 yes on expecting NOT FOUND |
| 144 | +-- let SEARCH_FILE=$t1_IBD |
| 145 | +-- source include/search_pattern_in_file.inc |
| 146 | +--let SEARCH_PATTERN=barfoo |
| 147 | +--echo # t2 yes on expecting NOT FOUND |
| 148 | +-- let SEARCH_FILE=$t2_IBD |
| 149 | +-- source include/search_pattern_in_file.inc |
| 150 | +--let SEARCH_PATTERN=tmpres |
| 151 | +--echo # t3 yes on expecting NOT FOUND |
| 152 | +-- let SEARCH_FILE=$t3_IBD |
| 153 | +-- source include/search_pattern_in_file.inc |
| 154 | +--let SEARCH_PATTERN=mysql |
| 155 | +--echo # t4 yes on expecting NOT FOUND |
| 156 | +-- let SEARCH_FILE=$t4_IBD |
| 157 | +-- source include/search_pattern_in_file.inc |
| 158 | + |
| 159 | +DROP PROCEDURE innodb_insert_proc; |
| 160 | +DROP TABLE t1,t2,t3,t4; |
| 161 | + |
| 162 | +# reset system |
| 163 | +--disable_query_log |
| 164 | +EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; |
| 165 | +EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; |
| 166 | +EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algo; |
| 167 | +--enable_query_log |
0 commit comments