| 1 |
-- source include/have_innodb.inc |
| 2 |
# This test is slow on buildbot. |
| 3 |
--source include/big_test.inc |
| 4 |
|
| 5 |
SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent; |
| 6 |
SET GLOBAL innodb_stats_persistent = 0; |
| 7 |
|
| 8 |
FLUSH TABLES; |
| 9 |
|
| 10 |
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`; |
| 11 |
let $MYSQLD_DATADIR = `SELECT @@datadir`; |
| 12 |
|
| 13 |
--echo # Treating compact format as dynamic format after import stmt |
| 14 |
|
| 15 |
CREATE TABLE t1 |
| 16 |
(a int AUTO_INCREMENT PRIMARY KEY, |
| 17 |
b blob, |
| 18 |
c blob, |
| 19 |
KEY (b(200))) ENGINE=InnoDB ROW_FORMAT=COMPACT; |
| 20 |
|
| 21 |
BEGIN; |
| 22 |
INSERT INTO t1 (b, c) values (repeat("ab", 200), repeat("bc", 200)); |
| 23 |
INSERT INTO t1 (b, c) values (repeat("bc", 200), repeat("cd", 200)); |
| 24 |
INSERT INTO t1 (b, c) values (repeat("cd", 200), repeat("ef", 200)); |
| 25 |
INSERT INTO t1 (b, c) values (repeat("de", 200), repeat("fg", 200)); |
| 26 |
INSERT INTO t1 (b, c) values (repeat("ef", 200), repeat("gh", 200)); |
| 27 |
INSERT INTO t1 (b, c) values (repeat("fg", 200), repeat("hi", 200)); |
| 28 |
INSERT INTO t1 (b, c) values (repeat("gh", 200), repeat("ij", 200)); |
| 29 |
INSERT INTO t1 (b, c) values (repeat("hi", 200), repeat("jk", 200)); |
| 30 |
INSERT INTO t1 (b, c) values (repeat("ij", 200), repeat("kl", 200)); |
| 31 |
INSERT INTO t1 (b, c) values (repeat("jk", 200), repeat("lm", 200)); |
| 32 |
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; |
| 33 |
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; |
| 34 |
COMMIT; |
| 35 |
SELECT COUNT(*) FROM t1; |
| 36 |
|
| 37 |
FLUSH TABLE t1 FOR EXPORT; |
| 38 |
--echo # List before copying files |
| 39 |
let MYSQLD_DATADIR =`SELECT @@datadir`; |
| 40 |
|
| 41 |
--list_files $MYSQLD_DATADIR/test |
| 42 |
perl; |
| 43 |
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; |
| 44 |
ib_backup_tablespaces("test", "t1"); |
| 45 |
EOF |
| 46 |
|
| 47 |
UNLOCK TABLES; |
| 48 |
ALTER TABLE t1 ROW_FORMAT=DYNAMIC; |
| 49 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 50 |
|
| 51 |
--list_files $MYSQLD_DATADIR/test |
| 52 |
perl; |
| 53 |
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; |
| 54 |
ib_discard_tablespaces("test", "t1"); |
| 55 |
ib_restore_tablespaces("test", "t1"); |
| 56 |
EOF |
| 57 |
|
| 58 |
--remove_file $MYSQLD_DATADIR/test/t1.cfg |
| 59 |
--error ER_INTERNAL_ERROR |
| 60 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 61 |
ALTER TABLE t1 DROP INDEX b; |
| 62 |
--disable_warnings |
| 63 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 64 |
--enable_warnings |
| 65 |
SHOW CREATE TABLE t1; |
| 66 |
|
| 67 |
--echo # Auto increment value must be more than maximum column value |
| 68 |
SELECT MAX(a) FROM t1; |
| 69 |
SELECT auto_increment FROM information_schema.tables |
| 70 |
WHERE table_name like 't1'; |
| 71 |
|
| 72 |
UPDATE t1 set b = repeat("de", 100) where b = repeat("cd", 200); |
| 73 |
--replace_column 9 # |
| 74 |
explain SELECT a FROM t1 where b = repeat("de", 100); |
| 75 |
SELECT a FROM t1 where b = repeat("de", 100); |
| 76 |
SELECT COUNT(*) FROM t1; |
| 77 |
DELETE FROM t1; |
| 78 |
--source include/wait_all_purged.inc |
| 79 |
CHECK TABLE t1; |
| 80 |
DROP TABLE t1; |
| 81 |
|
| 82 |
CREATE TABLE t1 |
| 83 |
(c1 int AUTO_INCREMENT PRIMARY KEY, |
| 84 |
c2 POINT NOT NULL, |
| 85 |
c3 LINESTRING NOT NULL, |
| 86 |
SPATIAL INDEX idx1(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT; |
| 87 |
|
| 88 |
INSERT INTO t1(c2,c3) VALUES( |
| 89 |
ST_GeomFromText('POINT(10 10)'), |
| 90 |
ST_GeomFromText('LINESTRING(5 5,20 20,30 30)')); |
| 91 |
|
| 92 |
INSERT INTO t1(c2,c3) VALUES( |
| 93 |
ST_GeomFromText('POINT(20 20)'), |
| 94 |
ST_GeomFromText('LINESTRING(5 15,20 10,30 20)')); |
| 95 |
|
| 96 |
INSERT INTO t1(c2,c3) VALUES( |
| 97 |
ST_GeomFromText('POINT(30 30)'), |
| 98 |
ST_GeomFromText('LINESTRING(10 5,20 24,30 32)')); |
| 99 |
|
| 100 |
INSERT INTO t1(c2,c3) VALUES( |
| 101 |
ST_GeomFromText('POINT(40 40)'), |
| 102 |
ST_GeomFromText('LINESTRING(15 5,25 20,35 30)')); |
| 103 |
|
| 104 |
INSERT INTO t1(c2,c3) VALUES( |
| 105 |
ST_GeomFromText('POINT(50 10)'), |
| 106 |
ST_GeomFromText('LINESTRING(15 15,24 10,31 20)')); |
| 107 |
|
| 108 |
INSERT INTO t1(c2,c3) VALUES( |
| 109 |
ST_GeomFromText('POINT(60 50)'), |
| 110 |
ST_GeomFromText('LINESTRING(10 15,20 44,35 32)')); |
| 111 |
|
| 112 |
BEGIN; |
| 113 |
INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; |
| 114 |
INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; |
| 115 |
INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; |
| 116 |
INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; |
| 117 |
INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; |
| 118 |
INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; |
| 119 |
INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; |
| 120 |
INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; |
| 121 |
INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; |
| 122 |
INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; |
| 123 |
INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; |
| 124 |
COMMIT; |
| 125 |
|
| 126 |
FLUSH TABLE t1 FOR EXPORT; |
| 127 |
--echo # List before copying files |
| 128 |
let MYSQLD_DATADIR =`SELECT @@datadir`; |
| 129 |
|
| 130 |
--list_files $MYSQLD_DATADIR/test |
| 131 |
perl; |
| 132 |
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; |
| 133 |
ib_backup_tablespaces("test", "t1"); |
| 134 |
EOF |
| 135 |
|
| 136 |
UNLOCK TABLES; |
| 137 |
ALTER TABLE t1 ROW_FORMAT=DYNAMIC; |
| 138 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 139 |
perl; |
| 140 |
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; |
| 141 |
ib_discard_tablespaces("test", "t1"); |
| 142 |
ib_restore_tablespaces("test", "t1"); |
| 143 |
EOF |
| 144 |
|
| 145 |
--remove_file $MYSQLD_DATADIR/test/t1.cfg |
| 146 |
--error ER_INTERNAL_ERROR |
| 147 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 148 |
--enable_warnings |
| 149 |
ALTER TABLE t1 DROP INDEX idx1; |
| 150 |
--replace_regex /opening '.*\/test\//opening '.\/test\// |
| 151 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 152 |
--disable_warnings |
| 153 |
SHOW CREATE TABLE t1; |
| 154 |
|
| 155 |
--echo # Auto increment value must be more than maximum column value |
| 156 |
SELECT MAX(c1) FROM t1; |
| 157 |
SELECT auto_increment FROM information_schema.tables |
| 158 |
WHERE table_name like 't1'; |
| 159 |
|
| 160 |
UPDATE t1 SET C2 = ST_GeomFromText('POINT(0 0)'); |
| 161 |
SELECT COUNT(*) FROM t1; |
| 162 |
DELETE FROM t1; |
| 163 |
CHECK TABLE t1; |
| 164 |
--source include/wait_all_purged.inc |
| 165 |
DROP TABLE t1; |
| 166 |
|
| 167 |
SET @save_algo = @@GLOBAL.innodb_compression_algorithm; |
| 168 |
--error 0,ER_WRONG_VALUE_FOR_VAR |
| 169 |
SET GLOBAL innodb_compression_algorithm=2; |
| 170 |
CREATE TABLE t1(a SERIAL) PAGE_COMPRESSED=1 ENGINE=InnoDB; |
| 171 |
INSERT INTO t1 VALUES(1); |
| 172 |
|
| 173 |
FLUSH TABLE t1 FOR EXPORT; |
| 174 |
--echo # List before copying files |
| 175 |
let MYSQLD_DATADIR =`SELECT @@datadir`; |
| 176 |
|
| 177 |
--list_files $MYSQLD_DATADIR/test |
| 178 |
perl; |
| 179 |
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; |
| 180 |
ib_backup_tablespaces("test", "t1"); |
| 181 |
EOF |
| 182 |
|
| 183 |
UNLOCK TABLES; |
| 184 |
SET GLOBAL innodb_compression_algorithm=0; |
| 185 |
ALTER TABLE t1 FORCE; |
| 186 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 187 |
|
| 188 |
--list_files $MYSQLD_DATADIR/test |
| 189 |
perl; |
| 190 |
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; |
| 191 |
ib_discard_tablespaces("test", "t1"); |
| 192 |
ib_restore_tablespaces("test", "t1"); |
| 193 |
EOF |
| 194 |
|
| 195 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 196 |
INSERT INTO t1 VALUES(2); |
| 197 |
SELECT * FROM t1; |
| 198 |
|
| 199 |
|
| 200 |
--error 0,ER_WRONG_VALUE_FOR_VAR |
| 201 |
SET GLOBAL innodb_compression_algorithm=3; |
| 202 |
FLUSH TABLE t1 FOR EXPORT; |
| 203 |
--echo # List before copying files |
| 204 |
let MYSQLD_DATADIR =`SELECT @@datadir`; |
| 205 |
|
| 206 |
--list_files $MYSQLD_DATADIR/test |
| 207 |
perl; |
| 208 |
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; |
| 209 |
ib_backup_tablespaces("test", "t1"); |
| 210 |
EOF |
| 211 |
|
| 212 |
UNLOCK TABLES; |
| 213 |
SET GLOBAL innodb_compression_algorithm=0; |
| 214 |
ALTER TABLE t1 FORCE; |
| 215 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 216 |
|
| 217 |
--echo # Display the discarded table name by using SPACE and PAGE_NO |
| 218 |
--echo # column in INNODB_SYS_INDEXES and discard doesn't affect the |
| 219 |
--echo # SPACE in INNODB_SYS_TABLES |
| 220 |
SELECT t.NAME, t.SPACE BETWEEN 1 and 0xFFFFFFEF as SYS_TABLE_SPACE_RANGE |
| 221 |
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t |
| 222 |
WHERE t.TABLE_ID IN ( |
| 223 |
SELECT i.TABLE_ID FROM |
| 224 |
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i WHERE |
| 225 |
i.PAGE_NO IS NULL and i.SPACE IS NULL); |
| 226 |
|
| 227 |
--list_files $MYSQLD_DATADIR/test |
| 228 |
perl; |
| 229 |
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; |
| 230 |
ib_discard_tablespaces("test", "t1"); |
| 231 |
ib_restore_tablespaces("test", "t1"); |
| 232 |
EOF |
| 233 |
|
| 234 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 235 |
INSERT INTO t1 VALUES(3); |
| 236 |
SELECT * FROM t1; |
| 237 |
DROP TABLE t1; |
| 238 |
|
| 239 |
SET GLOBAL innodb_compression_algorithm=@save_algo; |
| 240 |
SET GLOBAL innodb_stats_persistent = @save_stats_persistent; |