Commit 98d0c3c4 authored by Alice Sherepa's avatar Alice Sherepa

mdev-13625 /merged with mysql 5.6.37

parent dbaa8dda
--source include/have_debug.inc
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
--echo #
--echo # Bug #18010711 UNIQUE PREFIX INDEX ON BINARY COLUMN: FAILING
......@@ -9,3 +11,31 @@ insert into t1 values ('w'), ('w');
--error ER_DUP_ENTRY
create unique index index_t1 on t1(f1(4));
drop table t1;
--echo #
--echo #BUG#21326304 INNODB ONLINE ATER TABLE ENDS IN CRASH ON DISK FULL
--echo #
CREATE TABLE t1(f1 CHAR(255) NOT NULL, f2 CHAR(255) NOT NULL, f3
CHAR(255) NOT NULL, f4 CHAR(255) NOT NULL, f5 CHAR(255) NOT NULL,f6
CHAR(255) NOT NULL, f7 CHAR(255) NOT NULL, f8 CHAR(255) NOT NULL,f9
CHAR(255) NOT NULL, f10 CHAR(255) NOT NULL, f11 CHAR(255) NOT NULL,f12
CHAR(255) NOT NULL, f13 CHAR(255) NOT NULL, f14 CHAR(255) NOT NULL,f15
CHAR(255) NOT NULL, f16 CHAR(255) NOT NULL, f17 CHAR(255) NOT NULL,f18
CHAR(255) NOT NULL)ENGINE=INNODB;
INSERT INTO t1
VALUES('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r');
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
set debug_dbug="+d,disk_is_full";
--error ER_RECORD_FILE_FULL
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
set debug_dbug="-d,disk_is_full";
DROP TABLE t1;
......@@ -667,6 +667,26 @@ SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE = MyISAM;
INSERT INTO t1 (c1) VALUES (NULL), (-290783232), (NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
ALTER TABLE t1 ENGINE = InnoDB;
SELECT * FROM t1;
SHOW CREATE TABLE t1;
--error ER_AUTOINC_READ_FAILED
REPLACE INTO t1 (c2 ) VALUES (0);
SELECT * FROM t1;
DROP TABLE t1;
#DOUBLE
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB
AUTO_INCREMENT=10000000000000000000;
SHOW CREATE TABLE t1;
--error 1467
INSERT INTO t1 VALUES ();
DROP TABLE t1;
--echo #
--echo # Bug #14049391 INNODB MISCALCULATES AUTO-INCREMENT
--echo # AFTER CHANGING AUTO_INCREMENT_INCREMEMENT
......
......@@ -168,3 +168,22 @@ disconnect con2;
connection default;
DROP TABLE t1;
--echo Bug#19803418 ASSERTION: TABLE->QUIESCE == QUIESCE_NONE
--echo IN ROW0QUIESCE.CC LINE 683
CREATE TABLE t1(C TEXT CHARACTER SET UJIS) ENGINE=INNODB;
LOCK TABLES t1 WRITE,t1 AS t0 READ,t1 AS t2 READ;
FLUSH TABLE t1;
LOCK TABLES t1 READ,t1 AS t0 WRITE,t1 AS t2 READ;
FLUSH TABLE t1;
LOCK TABLES t1 READ,t1 AS t0 READ,t1 AS t2 READ;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
FLUSH TABLE t1;
UNLOCK TABLES;
FLUSH TABLE t1;
DROP TABLE t1;
......@@ -30,6 +30,8 @@ set optimizer_switch = 'mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
# the test to be run multiple times without restarting the mysqld server.
# See Bug#43309 Test main.innodb can't be run twice
-- disable_query_log
SET @innodb_thread_sleep_delay_orig = @@innodb_thread_sleep_delay;
SET @innodb_thread_concurrency_orig = @@innodb_thread_concurrency;
SET @innodb_rows_deleted_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted');
......@@ -1238,6 +1240,16 @@ insert into t1 values ('1111', '3333');
select distinct concat(a, b) from t1;
drop table t1;
#
# BUG#7709 test case - Boolean fulltext query against unsupported
# engines does not fail
#
#CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
#--error 1214
#SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
#DROP TABLE t1;
#
# check null values #1
#
......@@ -1277,6 +1289,9 @@ drop table t1;
create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=innodb;
insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
-- disable_result_log
analyze table t1;
-- enable_result_log
select * from t1 order by a,b,c,d;
explain select * from t1 order by a,b,c,d;
drop table t1;
......@@ -1328,6 +1343,43 @@ SELECT variable_value - @innodb_row_lock_time_orig FROM information_schema.globa
SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max';
SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
# Test for innodb_sync_spin_loops variable
SET @innodb_sync_spin_loops_orig = @@innodb_sync_spin_loops;
show variables like "innodb_sync_spin_loops";
set global innodb_sync_spin_loops=1000;
show variables like "innodb_sync_spin_loops";
set global innodb_sync_spin_loops=0;
show variables like "innodb_sync_spin_loops";
set global innodb_sync_spin_loops=20;
show variables like "innodb_sync_spin_loops";
set global innodb_sync_spin_loops=@innodb_sync_spin_loops_orig;
# Test for innodb_thread_concurrency variable
show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=1001;
show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=0;
show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=16;
show variables like "innodb_thread_concurrency";
# Test for innodb_concurrency_tickets variable
show variables like "innodb_concurrency_tickets";
set global innodb_concurrency_tickets=1000;
show variables like "innodb_concurrency_tickets";
set global innodb_concurrency_tickets=0;
show variables like "innodb_concurrency_tickets";
set global innodb_concurrency_tickets=5000;
show variables like "innodb_concurrency_tickets";
# Test for innodb_thread_sleep_delay variable
show variables like "innodb_thread_sleep_delay";
set global innodb_thread_sleep_delay=100000;
show variables like "innodb_thread_sleep_delay";
set global innodb_thread_sleep_delay=0;
show variables like "innodb_thread_sleep_delay";
set global innodb_thread_sleep_delay=10000;
show variables like "innodb_thread_sleep_delay";
#
# Test varchar
......@@ -2528,6 +2580,76 @@ select f1 from t1;
show status like "handler_read_key";
drop table t1;
#
# Test handling of writes to TEMPORARY tables for read-only transactions
#
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB;
# Check that the rollback works
START TRANSACTION READ ONLY;
INSERT INTO t2 VALUES(0);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
ROLLBACK;
SELECT * FROM t1;
SELECT * FROM t2;
START TRANSACTION READ ONLY;
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(1);
COMMIT;
SET TRANSACTION READ ONLY;
START TRANSACTION;
INSERT INTO t2 VALUES(3);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
COMMIT;
SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t2;
# This time with some indexes
CREATE TEMPORARY TABLE t2 (
c1 INT AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
SHOW CREATE TABLE t2;
# Check that the rollback works
START TRANSACTION READ ONLY;
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
ROLLBACK;
SELECT * FROM t1;
SELECT * FROM t2;
START TRANSACTION READ ONLY;
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
COMMIT;
SET TRANSACTION READ ONLY;
START TRANSACTION;
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
COMMIT;
SHOW CREATE TABLE t2;
SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
......
......@@ -88,7 +88,7 @@ BEGIN;
INSERT INTO t1 VALUES(1), (2), (3), (4);
# Request a crash on next execution of commit.
SET SESSION debug="+d,crash_commit_before";
set debug_dbug="+d,crash_commit_before";
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart:--innodb-force-recovery=3" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
......
......@@ -14,10 +14,14 @@ SET SESSION foreign_key_checks=0;
SET NAMES utf8;
-- let $t1_name = bug12661768_1
-- let $t2_name = bug12661768_2
-- let $fk_name = ab_on_2
-- let $key_str = 'bbb'
-- let $t1_name = bug12661768_1ä1111111111111111111111111111111111111111111111111
# We would also like to test with a name like #mysql50#bug12661768_2ä (the
# expected result is that it should appear as #mysql50#bug12661768_2ä in the
# error message, but due to a bug it is reported as bug12661768_2ä. See
# Bug#11758916 51180: EXPLAIN_FILENAME CANNOT EXPLAIN #SQL TEMPORARY FILE NAMES
-- let $t2_name = bug12661768_2ä2222222222222222222222222222222222222222222
-- let $fk_name = ab_on_2_fkfkfäfkffkfkfkfkfkfkfkfkfkfkfkfkfkfkfkfkfkfkfkfkfkfkfk
-- let $key_str = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
eval DROP TABLE IF EXISTS `$t2_name`, `$t1_name`;
......
......@@ -32,7 +32,23 @@ CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b);
SELECT * FROM corrupt_bit_test_ā;
select @@unique_checks;
select @@innodb_change_buffering_debug;
# Create enough rows for the table, so that the insert buffer will be
# used for modifying the secondary index page. There must be multiple
# index pages, because changes to the root page are never buffered.
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+10,z+10 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+20,z+20 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+50,z+50 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+100,z+100 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+200,z+200 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+400,z+400 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+800,z+800 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1600,z+1600 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+4000,z+4000 FROM corrupt_bit_test_ā;
select count(*) from corrupt_bit_test_ā;
......@@ -70,6 +86,7 @@ delete from corrupt_bit_test_ā where a = 10001;
insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001);
rollback;
# Drop one corrupted index before reboot
drop index idxā on corrupt_bit_test_ā;
check table corrupt_bit_test_ā;
......
......@@ -24,13 +24,13 @@ INSERT INTO child VALUES (1);
-- source include/restart_mysqld.inc
SET SESSION DEBUG='+d,test_upd_stats_if_needed_not_inited';
set debug_dbug='+d,test_upd_stats_if_needed_not_inited';
# this will cause row_update_statistics_if_needed() to be called for a table
# that is not opened (child) and thus has table->stat_initialized set to FALSE
DELETE FROM parent;
SET SESSION DEBUG='-d,test_upd_stats_if_needed_not_inited';
set debug_dbug='-d,test_upd_stats_if_needed_not_inited';
-- exec grep 'test_upd_stats_if_needed_not_inited was executed' $MYSQLTEST_VARDIR/log/mysqld.1.err || true
......
......@@ -9,8 +9,8 @@ CREATE TABLE t (c INT) ENGINE=INNODB;
# This will invoke test_ut_format_name() in debug builds
SET SESSION DEBUG='+d,test_ut_format_name';
set debug_dbug='+d,test_ut_format_name';
DROP TABLE t;
SET SESSION DEBUG='-d,test_ut_format_name';
set debug_dbug='-d,test_ut_format_name';
SET GLOBAL INNODB_OPTIMIZE_FULLTEXT_ONLY=1;
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
content TEXT
) ENGINE= InnoDB;
CREATE FULLTEXT INDEX idx ON articles (title, content);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
INSERT INTO articles (title, content) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
SET GLOBAL innodb_ft_aux_table="test/articles";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
1001 5 5 1 5 0
after 3 3 1 3 22
database 2 2 1 2 37
dbms 2 2 1 2 15
engine 5 6 2 5 46
engine 5 6 2 6 44
full 5 6 2 5 29
full 5 6 2 6 27
mysql 2 6 5 2 0
mysql 2 6 5 2 31
mysql 2 6 5 3 11
mysql 2 6 5 4 11
mysql 2 6 5 5 5
mysql 2 6 5 6 3
optimizing 4 4 1 4 0
search 5 6 2 5 39
search 5 6 2 6 37
show 4 4 1 4 42
stands 2 2 1 2 20
text 5 6 2 5 34
text 5 6 2 6 32
through 3 3 1 3 37
tricks 5 6 2 5 11
tricks 5 6 2 6 9
tutorial 2 4 2 2 6
tutorial 2 4 2 4 25
use 3 6 3 3 7
use 3 6 3 5 25
use 3 6 3 6 23
well 3 3 1 3 17
went 3 3 1 3 32
you 3 3 1 3 28
OPTIMIZE TABLE articles;
Table Op Msg_type Msg_text
test.articles optimize status OK
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
1001 5 5 1 5 0
after 3 3 1 3 22
database 2 2 1 2 37
dbms 2 2 1 2 15
engine 5 6 2 5 46
engine 5 6 2 6 44
full 5 6 2 5 29
full 5 6 2 6 27
mysql 2 6 5 2 0
mysql 2 6 5 2 31
mysql 2 6 5 3 11
mysql 2 6 5 4 11
mysql 2 6 5 5 5
mysql 2 6 5 6 3
optimizing 4 4 1 4 0
search 5 6 2 5 39
search 5 6 2 6 37
show 4 4 1 4 42
stands 2 2 1 2 20
text 5 6 2 5 34
text 5 6 2 6 32
through 3 3 1 3 37
tricks 5 6 2 5 11
tricks 5 6 2 6 9
tutorial 2 4 2 2 6
tutorial 2 4 2 4 25
use 3 6 3 3 7
use 3 6 3 5 25
use 3 6 3 6 23
well 3 3 1 3 17
went 3 3 1 3 32
you 3 3 1 3 28
set debug_dbug="+d,fts_instrument_result_cache_limit";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
1001 5 5 1 5 0
after 3 3 1 3 22
database 2 2 1 2 37
dbms 2 2 1 2 15
engine 5 6 2 5 46
engine 5 6 2 6 44
full 5 6 2 5 29
full 5 6 2 6 27
mysql 2 6 5 2 0
mysql 2 6 5 2 31
mysql 2 6 5 3 11
mysql 2 6 5 4 11
mysql 2 6 5 5 5
mysql 2 6 5 6 3
optimizing 4 4 1 4 0
search 5 6 2 5 39
search 5 6 2 6 37
show 4 4 1 4 42
stands 2 2 1 2 20
text 5 6 2 5 34
text 5 6 2 6 32
through 3 3 1 3 37
tricks 5 6 2 5 11
tricks 5 6 2 6 9
tutorial 2 4 2 2 6
tutorial 2 4 2 4 25
use 3 6 3 3 7
use 3 6 3 5 25
use 3 6 3 6 23
well 3 3 1 3 17
went 3 3 1 3 32
you 3 3 1 3 28
set debug_dbug="-d,fts_instrument_result_cache_limit";
DROP TABLE articles;
SET GLOBAL innodb_ft_result_cache_limit=default;
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
content TEXT
) ENGINE= InnoDB;
CREATE FULLTEXT INDEX idx_t ON articles (title);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
CREATE FULLTEXT INDEX idx_c ON articles (content);
INSERT INTO articles (title, content) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
1001 5 5 1 5 0
mysql 2 6 5 2 0
mysql 2 6 5 3 11
mysql 2 6 5 4 11
mysql 2 6 5 5 5
mysql 2 6 5 6 3
optimizing 4 4 1 4 0
tricks 5 6 2 5 11
tricks 5 6 2 6 9
tutorial 2 2 1 2 6
use 3 3 1 3 7
well 3 3 1 3 17
after 3 3 1 3 0
database 2 2 1 2 22
dbms 2 2 1 2 0
engine 5 6 2 5 28
engine 5 6 2 6 28
full 5 6 2 5 11
full 5 6 2 6 11
mysql 2 2 1 2 16
search 5 6 2 5 21
search 5 6 2 6 21
show 4 4 1 4 25
stands 2 2 1 2 5
text 5 6 2 5 16
text 5 6 2 6 16
through 3 3 1 3 15
tutorial 4 4 1 4 8
use 5 6 2 5 7
use 5 6 2 6 7
went 3 3 1 3 10
you 3 3 1 3 6
SET GLOBAL innodb_ft_aux_table="test/articles";
OPTIMIZE TABLE articles;
Table Op Msg_type Msg_text
test.articles optimize status OK
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
1001 5 5 1 5 0
mysql 2 6 5 2 0
mysql 2 6 5 3 11
mysql 2 6 5 4 11
mysql 2 6 5 5 5
mysql 2 6 5 6 3
optimizing 4 4 1 4 0
tricks 5 6 2 5 11
tricks 5 6 2 6 9
tutorial 2 2 1 2 6
use 3 3 1 3 7
well 3 3 1 3 17
after 3 3 1 3 0
database 2 2 1 2 22
dbms 2 2 1 2 0
engine 5 6 2 5 28
engine 5 6 2 6 28
full 5 6 2 5 11
full 5 6 2 6 11
mysql 2 2 1 2 16
search 5 6 2 5 21
search 5 6 2 6 21
show 4 4 1 4 25
stands 2 2 1 2 5
text 5 6 2 5 16
text 5 6 2 6 16
through 3 3 1 3 15
tutorial 4 4 1 4 8
use 5 6 2 5 7
use 5 6 2 6 7
went 3 3 1 3 10
you 3 3 1 3 6
DROP TABLE articles;
SET NAMES utf8;
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE FULLTEXT INDEX idx ON articles (title);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
INSERT INTO articles (title) VALUES
('相亲相爱'),('怜香惜爱'),('充满可爱'),('爱恨交织');
SET GLOBAL innodb_ft_aux_table="test/articles";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
充满可爱 4 4 1 4 0
怜香惜爱 3 3 1 3 0
爱恨交织 5 5 1 5 0
相亲相爱 2 2 1 2 0
OPTIMIZE TABLE articles;
Table Op Msg_type Msg_text
test.articles optimize status OK
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
充满可爱 4 4 1 4 0
怜香惜爱 3 3 1 3 0
爱恨交织 5 5 1 5 0
相亲相爱 2 2 1 2 0
DROP TABLE articles;
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200)
) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
CREATE FULLTEXT INDEX idx ON articles (title);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
INSERT INTO articles (title) VALUES
('相亲相爱'),('怜香惜爱'),('充满可爱'),('爱恨交织');
SET GLOBAL innodb_ft_aux_table="test/articles";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
爱恨交织 5 5 1 5 0
充满可爱 4 4 1 4 0
怜香惜爱 3 3 1 3 0
相亲相爱 2 2 1 2 0
OPTIMIZE TABLE articles;
Table Op Msg_type Msg_text
test.articles optimize status OK
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
爱恨交织 5 5 1 5 0
充满可爱 4 4 1 4 0
怜香惜爱 3 3 1 3 0
相亲相爱 2 2 1 2 0
DROP TABLE articles;
SET GLOBAL innodb_ft_aux_table=default;
SET GLOBAL INNODB_OPTIMIZE_FULLTEXT_ONLY=default;
# Case 1: Test select and insert(row in both disk and cache)
CREATE TABLE t1 (
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
FULLTEXT(title)
) ENGINE = InnoDB;
INSERT INTO t1(title) VALUES('mysql');
INSERT INTO t1(title) VALUES('database');
set debug_dbug="+d,fts_instrument_sync_debug";
SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR selected';
INSERT INTO t1(title) VALUES('mysql database');
SET DEBUG_SYNC= 'now WAIT_FOR written';
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
database 2 3 2 2 0
database 2 3 2 3 6
mysql 1 3 2 1 0
mysql 1 3 2 3 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
FTS_DOC_ID title
1 mysql
2 database
SET DEBUG_SYNC= 'now SIGNAL selected';
/* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
set debug_dbug="-d,fts_instrument_sync_debug";
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
database 2 3 2 2 0
database 2 3 2 3 6
mysql 1 3 2 1 0
mysql 1 3 2 3 0
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
FTS_DOC_ID title
3 mysql database
1 mysql
2 database
DROP TABLE t1;
# Case 2: Test insert and insert(sync)
CREATE TABLE t1 (
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
FULLTEXT(title)
) ENGINE = InnoDB;
INSERT INTO t1(title) VALUES('mysql');
INSERT INTO t1(title) VALUES('database');
set debug_dbug="+d,fts_instrument_sync_debug";
SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR inserted';
INSERT INTO t1(title) VALUES('mysql database');
SET DEBUG_SYNC= 'now WAIT_FOR written';
INSERT INTO t1(title) VALUES('mysql database');
SET DEBUG_SYNC= 'now SIGNAL inserted';
/* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
set debug_dbug="-d,fts_instrument_sync_debug";
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
database 2 3 2 2 0
database 2 3 2 3 6
database 4 4 1 4 6
mysql 1 4 3 1 0
mysql 1 4 3 3 0
mysql 1 4 3 4 0
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
FTS_DOC_ID title
3 mysql database
4 mysql database
1 mysql
2 database
DROP TABLE t1;
# Case 3: Test insert crash recovery
CREATE TABLE t1 (
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
FULLTEXT(title)
) ENGINE = InnoDB;
INSERT INTO t1(title) VALUES('database');
set debug_dbug="+d,fts_instrument_sync_debug,fts_write_node_crash";
INSERT INTO t1(title) VALUES('mysql');
ERROR HY000: Lost connection to MySQL server during query
After restart
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
FTS_DOC_ID title
1 database
set debug_dbug="+d,fts_instrument_sync_debug";
INSERT INTO t1(title) VALUES('mysql');
set debug_dbug="-d,fts_instrument_sync_debug";
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
FTS_DOC_ID title
1 database
2 mysql
DROP TABLE t1;
# Case 4: Test sync commit & rollback in background
CREATE TABLE t1(
id INT AUTO_INCREMENT,
title VARCHAR(100),
FULLTEXT(title),
PRIMARY KEY(id)) ENGINE=InnoDB;
set debug_dbug="+d,fts_instrument_sync";
INSERT INTO t1(title) VALUES('mysql');
set debug_dbug="-d,fts_instrument_sync";
set debug_dbug="+d,fts_instrument_sync,fts_instrument_sync_interrupted";
INSERT INTO t1(title) VALUES('database');
set debug_dbug="-d,fts_instrument_sync,fts_instrument_sync_interrupted";
set debug_dbug="+d,fts_instrument_sync_debug";
INSERT INTO t1(title) VALUES('good');
set debug_dbug="-d,fts_instrument_sync_debug";
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
database 2 2 1 2 0
good 4 4 1 4 0
mysql 1 1 1 1 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database good');
id title
1 mysql
2 database
3 good
DROP TABLE t1;
......@@ -11,7 +11,7 @@ LET $regexp=/FTS_([0-9a-f_]+)([A-Z_]+)/FTS_AUX_\2/;
--echo # Simulating old non-windows(< 5.6.16) data directory
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
set debug_dbug='+d,innodb_test_wrong_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a, b))engine=innodb;
INSERT INTO t1 VALUES('TEST1', 'TEST2');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2');
......@@ -33,8 +33,8 @@ DROP TABLE t1;
--echo # Simulating old windows (< 5.6.16) data directory
let $MYSQLD_DATADIR= `select @@datadir`;
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL DEBUG='+d,innodb_test_wrong_windows_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_windows_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a, b))engine=innodb;
INSERT INTO t1 VALUES('TEST1', 'TEST2');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2');
......@@ -81,14 +81,14 @@ call mtr.add_suppression("\\[Warning\\] InnoDB: Parent table of FTS auxiliary ta
call mtr.add_suppression("\\[ERROR] InnoDB: Flagged corruption of .* in table .* in DROP ORPHANED TABLE");
call mtr.add_suppression("\\[Warning\\] InnoDB: Setting aux table .* to hex format failed.");
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT `AB` (a, b), FULLTEXT `C1` (c));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
SET GLOBAL DEBUG='-d,innodb_test_wrong_fts_sys_table_name';
SET GLOBAL debug_dbug='-d,innodb_test_wrong_fts_sys_table_name';
# Write file to make mysql-test-run.pl wait for the server to stop
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
......@@ -138,14 +138,14 @@ DROP TABLE t1;
--echo # Non windows parent table flag failure.
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT(a, b), FULLTEXT(c));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
SET GLOBAL DEBUG='-d,innodb_test_wrong_fts_sys_table_name';
SET GLOBAL debug_dbug='-d,innodb_test_wrong_fts_sys_table_name';
# Write file to make mysql-test-run.pl wait for the server to stop
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
......@@ -179,14 +179,14 @@ DROP TABLE t1;
# Remove the orphaned table
-- source include/restart_mysqld.inc
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL DEBUG='+d,innodb_test_wrong_windows_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_windows_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT f1(a, b));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
alter table t1 drop index f1;
SET SESSION debug='-d,innodb_test_wrong_fts_sys_table_name';
SET SESSION debug_dbug='-d,innodb_test_wrong_fts_sys_table_name';
--replace_regex $regexp
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
......@@ -210,15 +210,15 @@ call mtr.add_suppression("\\[Warning\\] InnoDB: Rollback operations on all aux t
call mtr.add_suppression("\\[ERROR\\] InnoDB: Flagged corruption of .* in table .* in DROP ORPHANED TABLE");
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL DEBUG='+d,innodb_test_wrong_windows_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_windows_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT `AB`(a, b), FULLTEXT `C1`(c));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
SET SESSION debug='-d,innodb_test_wrong_fts_sys_table_name';
SET SESSION debug_dbug='-d,innodb_test_wrong_fts_sys_table_name';
# Write file to make mysql-test-run.pl wait for the server to stop
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
......
......@@ -10,8 +10,8 @@ LET $regexp=/FTS_([0-9a-f_]+)([A-Z_]+)/FTS_AUX_\2/;
--echo # Simulating old non-windows(< 5.6.16) data directory
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL DEBUG='+d,innodb_test_wrong_non_windows_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_non_windows_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a, b))engine=innodb;
INSERT INTO t1 VALUES('TEST1', 'TEST2');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2');
......@@ -32,7 +32,7 @@ DROP TABLE t1;
--echo # Simulating old windows (< 5.6.16) data directory
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a, b))engine=innodb;
INSERT INTO t1 VALUES('TEST1', 'TEST2');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2');
......@@ -76,15 +76,15 @@ call mtr.add_suppression("\\[Warning\\] InnoDB: Parent table of FTS auxiliary ta
call mtr.add_suppression("\\[ERROR] InnoDB: Flagged corruption of .* in table .* in DROP ORPHANED TABLE");
call mtr.add_suppression("\\[Warning\\] InnoDB: Setting aux table .* to hex format failed.");
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL DEBUG='+d,innodb_test_wrong_non_windows_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_non_windows_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT `AB` (a, b), FULLTEXT `C1`(c));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
SET GLOBAL DEBUG='-d,innodb_test_wrong_fts_sys_table_name';
SET GLOBAL debug_dbug='-d,innodb_test_wrong_fts_sys_table_name';
# Write file to make mysql-test-run.pl wait for the server to stop
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
......@@ -134,15 +134,15 @@ DROP TABLE t1;
--echo # Non windows parent table flag failure.
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL DEBUG='+d,innodb_test_wrong_non_windows_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_non_windows_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT(a, b), FULLTEXT(c));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
SET GLOBAL DEBUG='-d,innodb_test_wrong_fts_sys_table_name';
SET GLOBAL debug_dbug='-d,innodb_test_wrong_fts_sys_table_name';
# Write file to make mysql-test-run.pl wait for the server to stop
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
......@@ -176,13 +176,13 @@ DROP TABLE t1;
# Remove the orphaned table
-- source include/restart_mysqld.inc
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT f1(a, b));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
alter table t1 drop index f1;
SET SESSION debug='-d,innodb_test_wrong_fts_sys_table_name';
SET SESSION debug_dbug='-d,innodb_test_wrong_fts_sys_table_name';
--replace_regex $regexp
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
......@@ -206,14 +206,14 @@ call mtr.add_suppression("\\[Warning\\] InnoDB: Rollback operations on all aux t
call mtr.add_suppression("\\[ERROR\\] InnoDB: Flagged corruption of .* in table .* in DROP ORPHANED TABLE");
SET GLOBAL DEBUG='+d,innodb_test_wrong_fts_aux_table_name';
SET GLOBAL debug_dbug='+d,innodb_test_wrong_fts_aux_table_name';
CREATE TABLE t1(a TEXT, b TEXT, c TEXT, FULLTEXT `AB`(a, b), FULLTEXT `C1`(c));
INSERT INTO t1 VALUES('TEST1', 'TEST2', 'TEXT3');
INSERT INTO t1 VALUES('TEXT1', 'TEXT2', 'TEXT5');
SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ('TEST2');
SELECT * FROM t1 WHERE MATCH(c) AGAINST ('TEXT5');
SET SESSION debug='-d,innodb_test_wrong_fts_sys_table_name';
SET SESSION debug_dbug='-d,innodb_test_wrong_fts_sys_table_name';
# Write file to make mysql-test-run.pl wait for the server to stop
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
......
--innodb-ft-index-cache
--innodb-ft-index-table
......@@ -32,11 +32,11 @@ OPTIMIZE TABLE articles;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SET SESSION debug="+d,fts_instrument_result_cache_limit";
SET SESSION debug_dbug="+d,fts_instrument_result_cache_limit";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SET SESSION debug="-d,fts_instrument_result_cache_limit";
SET SESSION debug_dbug="-d,fts_instrument_result_cache_limit";
DROP TABLE articles;
......
--innodb-ft-index-cache
--innodb-ft-index-table
......@@ -24,7 +24,7 @@ INSERT INTO t1(title) VALUES('database');
connection con1;
SET SESSION debug="+d,fts_instrument_sync_debug";
SET SESSION debug_dbug="+d,fts_instrument_sync_debug";
SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR selected';
......@@ -47,7 +47,7 @@ connection con1;
--echo /* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
--reap
SET SESSION debug="-d,fts_instrument_sync_debug";
SET SESSION debug_dbug="-d,fts_instrument_sync_debug";
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
......@@ -72,7 +72,7 @@ INSERT INTO t1(title) VALUES('database');
connection con1;
SET SESSION debug="+d,fts_instrument_sync_debug";
SET SESSION debug_dbug="+d,fts_instrument_sync_debug";
SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR inserted';
......@@ -90,7 +90,7 @@ connection con1;
--echo /* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
--reap
SET SESSION debug="-d,fts_instrument_sync_debug";
SET SESSION debug_dbug="-d,fts_instrument_sync_debug";
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
......@@ -117,7 +117,7 @@ INSERT INTO t1(title) VALUES('database');
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug="+d,fts_instrument_sync_debug,fts_write_node_crash";
SET SESSION debug_dbug="+d,fts_instrument_sync_debug,fts_write_node_crash";
--error 2013
INSERT INTO t1(title) VALUES('mysql');
......@@ -127,11 +127,11 @@ INSERT INTO t1(title) VALUES('mysql');
-- echo After restart
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
SET SESSION debug="+d,fts_instrument_sync_debug";
SET SESSION debug_dbug="+d,fts_instrument_sync_debug";
INSERT INTO t1(title) VALUES('mysql');
SET SESSION debug="-d,fts_instrument_sync_debug";
SET SESSION debug_dbug="-d,fts_instrument_sync_debug";
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
......@@ -144,19 +144,19 @@ CREATE TABLE t1(
FULLTEXT(title),
PRIMARY KEY(id)) ENGINE=InnoDB;
SET SESSION debug="+d,fts_instrument_sync";
SET SESSION debug_dbug="+d,fts_instrument_sync";
INSERT INTO t1(title) VALUES('mysql');
SET SESSION debug="-d,fts_instrument_sync";
SET SESSION debug_dbug="-d,fts_instrument_sync";
--source include/restart_mysqld.inc
SET GLOBAL debug="+d,fts_instrument_sync,fts_instrument_sync_interrupted";
SET GLOBAL debug_dbug="+d,fts_instrument_sync,fts_instrument_sync_interrupted";
INSERT INTO t1(title) VALUES('database');
SET GLOBAL debug="-d,fts_instrument_sync,fts_instrument_sync_interrupted";
SET GLOBAL debug_dbug="-d,fts_instrument_sync,fts_instrument_sync_interrupted";
SET SESSION debug="+d,fts_instrument_sync_debug";
SET SESSION debug_dbug="+d,fts_instrument_sync_debug";
INSERT INTO t1(title) VALUES('good');
SET SESSION debug="-d,fts_instrument_sync_debug";
SET SESSION debug_dbug="-d,fts_instrument_sync_debug";
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
......
......@@ -11,8 +11,7 @@
SET @old_log_output = @@global.log_output;
SET @old_slow_query_log = @@global.slow_query_log;
SET @old_general_log = @@global.general_log;
SET @old_long_query_time = @@global.long_query_time;
SET @old_binlog_order_commits = @@global.binlog_order_commits;
SET @old_long_query_time = @@global.long_query_time
SET GLOBAL log_output = 'TABLE';
SET GLOBAL general_log = 1;
......@@ -33,7 +32,7 @@ CREATE TABLE t1 (
connection con1;
SET GLOBAL debug="+d,fts_instrument_sync_debug,fts_instrument_sync_sleep";
SET GLOBAL debug_dbug="+d,fts_instrument_sync_debug,fts_instrument_sync_sleep";
SET DEBUG_SYNC= 'fts_sync_begin SIGNAL begin WAIT_FOR continue';
......@@ -62,7 +61,7 @@ SELECT SLEEP(2);
-- echo # slow log results should only contain INSERT INTO t1.
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
SET GLOBAL debug="-d,fts_instrument_sync_debug,fts_instrument_sync_sleep";
SET GLOBAL debug_dbug="-d,fts_instrument_sync_debug,fts_instrument_sync_sleep";
TRUNCATE TABLE mysql.slow_log;
DROP TABLE t1;
......@@ -122,4 +121,5 @@ SET GLOBAL log_output = @old_log_output;
SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @old_slow_query_log;
SET GLOBAL long_query_time = @old_long_query_time;
SET GLOBAL binlog_order_commits = @old_binlog_order_commits;
#SET DEBUG_SYNC='RESET';
SET default_storage_engine=InnoDB;
#
# A series of tests to make sure tables are opened after restart.
# Bug#13357607 Compressed file-per-table tablespaces fail to open
#
set global innodb_file_per_table=on;
set global innodb_file_format='Barracuda';
#
# Create and insert records into a DYNAMIC row formatted table.
#
CREATE TABLE t1(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=REDUNDANT ENGINE=InnoDB;
INSERT INTO t1 VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t1 (SELECT 0, c2, c3, c4, c5 FROM t1);
INSERT INTO t1 (SELECT 0, c2, c3, c4, c5 FROM t1);
INSERT INTO t1 (SELECT 0, c2, c3, c4, c5 FROM t1);
INSERT INTO t1 (SELECT 0, c2, c3, c4, c5 FROM t1);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
SELECT count(*) FROM t1;
count(*)
16
#
# Create and insert records into a COMPACT row formatted table.
#
CREATE TABLE t2(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=COMPACT ENGINE=InnoDB;
INSERT INTO t2 VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t2 (SELECT 0, c2, c3, c4, c5 FROM t2);
INSERT INTO t2 (SELECT 0, c2, c3, c4, c5 FROM t2);
INSERT INTO t2 (SELECT 0, c2, c3, c4, c5 FROM t2);
INSERT INTO t2 (SELECT 0, c2, c3, c4, c5 FROM t2);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
SELECT count(*) FROM t2;
count(*)
16
#
# Create and insert records into a COMPRESSED row formatted table.
#
CREATE TABLE t3(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 ENGINE=InnoDB;
INSERT INTO t3 VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t3 (SELECT 0, c2, c3, c4, c5 FROM t3);
INSERT INTO t3 (SELECT 0, c2, c3, c4, c5 FROM t3);
INSERT INTO t3 (SELECT 0, c2, c3, c4, c5 FROM t3);
INSERT INTO t3 (SELECT 0, c2, c3, c4, c5 FROM t3);
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4
SELECT count(*) FROM t3;
count(*)
16
#
# Create and insert records into a DYNAMIC row formatted table.
#
CREATE TABLE t4(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=DYNAMIC ENGINE=InnoDB;
INSERT INTO t4 VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t4 (SELECT 0, c2, c3, c4, c5 FROM t4);
INSERT INTO t4 (SELECT 0, c2, c3, c4, c5 FROM t4);
INSERT INTO t4 (SELECT 0, c2, c3, c4, c5 FROM t4);
INSERT INTO t4 (SELECT 0, c2, c3, c4, c5 FROM t4);
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
SELECT count(*) FROM t4;
count(*)
16
#
# Create and insert records into a table that uses a remote DATA DIRECTORY.
#
CREATE TABLE t5(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=DYNAMIC ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
INSERT INTO t5 VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t5 (SELECT 0, c2, c3, c4, c5 FROM t5);
INSERT INTO t5 (SELECT 0, c2, c3, c4, c5 FROM t5);
INSERT INTO t5 (SELECT 0, c2, c3, c4, c5 FROM t5);
INSERT INTO t5 (SELECT 0, c2, c3, c4, c5 FROM t5);
SHOW CREATE TABLE t5;
Table Create Table
t5 CREATE TABLE `t5` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000027 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
SELECT count(*) FROM t5;
count(*)
16
#
# Create and insert records into a partitioned table that uses
# a remote DATA DIRECTORY for each partition.
#
CREATE TABLE t6(
c1 INT AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=COMPRESSED ENGINE=InnoDB
PARTITION BY HASH(c1) (
PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir',
PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir',
PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir');
INSERT INTO t6 VALUES (0, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t6 (SELECT 0, c2, c3, c4, c5 FROM t6);
INSERT INTO t6 (SELECT 0, c2, c3, c4, c5 FROM t6);
INSERT INTO t6 (SELECT 0, c2, c3, c4, c5 FROM t6);
INSERT INTO t6 (SELECT 0, c2, c3, c4, c5 FROM t6);
SHOW CREATE TABLE t6;
Table Create Table
t6 CREATE TABLE `t6` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
/*!50100 PARTITION BY HASH (c1)
(PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) */
SELECT count(*) FROM t6;
count(*)
16
#
# Create and insert records into a subpartitioned table that uses
# a remote DATA DIRECTORY for each subpartition.
#
CREATE TABLE t7(
c1 INT AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
ROW_FORMAT=DYNAMIC ENGINE=InnoDB
PARTITION BY RANGE(c1) SUBPARTITION BY HASH(c1) (
PARTITION p0 VALUES LESS THAN (10) (
SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir',
SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir'),
PARTITION p1 VALUES LESS THAN MAXVALUE (
SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir',
SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir'));
INSERT INTO t7 VALUES (0, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t7 (SELECT 0, c2, c3, c4, c5 FROM t7);
INSERT INTO t7 (SELECT 0, c2, c3, c4, c5 FROM t7);
INSERT INTO t7 (SELECT 0, c2, c3, c4, c5 FROM t7);
INSERT INTO t7 (SELECT 0, c2, c3, c4, c5 FROM t7);
SHOW CREATE TABLE t7;
Table Create Table
t7 CREATE TABLE `t7` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
/*!50100 PARTITION BY RANGE (c1)
SUBPARTITION BY HASH (c1)
(PARTITION p0 VALUES LESS THAN (10)
(SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB),
PARTITION p1 VALUES LESS THAN MAXVALUE
(SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) */
SELECT count(*) FROM t7;
count(*)
16
#
# Show these tables in information_schema.
#
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables
WHERE name like 'test%' ORDER BY name;
name n_cols file_format row_format
test/t1 8 Antelope Redundant
test/t2 8 Antelope Compact
test/t3 8 Barracuda Compressed
test/t4 8 Barracuda Dynamic
test/t5 8 Barracuda Dynamic
test/t6#p#p0 8 Barracuda Compressed
test/t6#p#p1 8 Barracuda Compressed
test/t6#p#p2 8 Barracuda Compressed
test/t7#p#p0#sp#s0 8 Barracuda Dynamic
test/t7#p#p0#sp#s1 8 Barracuda Dynamic
test/t7#p#p1#sp#s2 8 Barracuda Dynamic
test/t7#p#p1#sp#s3 8 Barracuda Dynamic
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
WHERE name LIKE 'test%' ORDER BY name;
name file_format row_format
test/t1 Antelope Compact or Redundant
test/t2 Antelope Compact or Redundant
test/t3 Barracuda Compressed
test/t4 Barracuda Dynamic
test/t5 Barracuda Dynamic
test/t6#p#p0 Barracuda Compressed
test/t6#p#p1 Barracuda Compressed
test/t6#p#p2 Barracuda Compressed
test/t7#p#p0#sp#s0 Barracuda Dynamic
test/t7#p#p0#sp#s1 Barracuda Dynamic
test/t7#p#p1#sp#s2 Barracuda Dynamic
test/t7#p#p1#sp#s3 Barracuda Dynamic
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_DATA_DIR/test/t1.ibd
MYSQL_DATA_DIR/test/t2.ibd
MYSQL_DATA_DIR/test/t3.ibd
MYSQL_DATA_DIR/test/t4.ibd
MYSQL_TMP_DIR/alt_dir/test/t5.ibd
MYSQL_TMP_DIR/alt_dir/test/t6#p#p0.ibd
MYSQL_TMP_DIR/alt_dir/test/t6#p#p1.ibd
MYSQL_TMP_DIR/alt_dir/test/t6#p#p2.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p0#sp#s0.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p0#sp#s1.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p1#sp#s2.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p1#sp#s3.ibd
#
# Shutdown the server and list the tablespace OS files
#
---- MYSQL_DATA_DIR/test
t1.frm
t1.ibd
t2.frm
t2.ibd
t3.frm
t3.ibd
t4.frm
t4.ibd
t5.frm
t5.isl
t6#p#p0.isl
t6#p#p1.isl
t6#p#p2.isl
t6.frm
t6.par
t7#p#p0#sp#s0.isl
t7#p#p0#sp#s1.isl
t7#p#p1#sp#s2.isl
t7#p#p1#sp#s3.isl
t7.frm
t7.par
---- MYSQL_TMP_DIR/alt_dir
test
---- MYSQL_TMP_DIR/alt_dir/test
t5.ibd
t6#p#p0.ibd
t6#p#p1.ibd
t6#p#p2.ibd
t7#p#p0#sp#s0.ibd
t7#p#p0#sp#s1.ibd
t7#p#p1#sp#s2.ibd
t7#p#p1#sp#s3.ibd
#
# Start the server and show that tables are still visible and accessible.
#
SHOW VARIABLES LIKE 'innodb_file_per_table';
Variable_name Value
innodb_file_per_table ON
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
SHOW CREATE TABLE t5;
Table Create Table
t5 CREATE TABLE `t5` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000020 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
SHOW CREATE TABLE t6;
Table Create Table
t6 CREATE TABLE `t6` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
/*!50100 PARTITION BY HASH (c1)
(PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) */
SHOW CREATE TABLE t7;
Table Create Table
t7 CREATE TABLE `t7` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
/*!50100 PARTITION BY RANGE (c1)
SUBPARTITION BY HASH (c1)
(PARTITION p0 VALUES LESS THAN (10)
(SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB),
PARTITION p1 VALUES LESS THAN MAXVALUE
(SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) */
INSERT INTO t1 (SELECT 0, c2, c3, c4, c5 FROM t1);
INSERT INTO t2 (SELECT 0, c2, c3, c4, c5 FROM t2);
INSERT INTO t3 (SELECT 0, c2, c3, c4, c5 FROM t3);
INSERT INTO t4 (SELECT 0, c2, c3, c4, c5 FROM t4);
INSERT INTO t5 (SELECT 0, c2, c3, c4, c5 FROM t5);
INSERT INTO t6 (SELECT 0, c2, c3, c4, c5 FROM t6);
INSERT INTO t7 (SELECT 0, c2, c3, c4, c5 FROM t7);
SELECT count(*) FROM t1;
count(*)
32
SELECT count(*) FROM t2;
count(*)
32
SELECT count(*) FROM t3;
count(*)
32
SELECT count(*) FROM t4;
count(*)
32
SELECT count(*) FROM t5;
count(*)
32
SELECT count(*) FROM t6;
count(*)
32
SELECT count(*) FROM t7;
count(*)
32
#
# Show these tables in information_schema.
#
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables
WHERE name like 'test%' ORDER BY name;
name n_cols file_format row_format
test/t1 8 Antelope Redundant
test/t2 8 Antelope Compact
test/t3 8 Barracuda Compressed
test/t4 8 Barracuda Dynamic
test/t5 8 Barracuda Dynamic
test/t6#p#p0 8 Barracuda Compressed
test/t6#p#p1 8 Barracuda Compressed
test/t6#p#p2 8 Barracuda Compressed
test/t7#p#p0#sp#s0 8 Barracuda Dynamic
test/t7#p#p0#sp#s1 8 Barracuda Dynamic
test/t7#p#p1#sp#s2 8 Barracuda Dynamic
test/t7#p#p1#sp#s3 8 Barracuda Dynamic
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
WHERE name LIKE 'test%' ORDER BY name;
name file_format row_format
test/t1 Antelope Compact or Redundant
test/t2 Antelope Compact or Redundant
test/t3 Barracuda Compressed
test/t4 Barracuda Dynamic
test/t5 Barracuda Dynamic
test/t6#p#p0 Barracuda Compressed
test/t6#p#p1 Barracuda Compressed
test/t6#p#p2 Barracuda Compressed
test/t7#p#p0#sp#s0 Barracuda Dynamic
test/t7#p#p0#sp#s1 Barracuda Dynamic
test/t7#p#p1#sp#s2 Barracuda Dynamic
test/t7#p#p1#sp#s3 Barracuda Dynamic
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_DATA_DIR/test/t1.ibd
MYSQL_DATA_DIR/test/t2.ibd
MYSQL_DATA_DIR/test/t3.ibd
MYSQL_DATA_DIR/test/t4.ibd
MYSQL_TMP_DIR/alt_dir/test/t5.ibd
MYSQL_TMP_DIR/alt_dir/test/t6#p#p0.ibd
MYSQL_TMP_DIR/alt_dir/test/t6#p#p1.ibd
MYSQL_TMP_DIR/alt_dir/test/t6#p#p2.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p0#sp#s0.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p0#sp#s1.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p1#sp#s2.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p1#sp#s3.ibd
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
#
# Truncate the remote tablespaces.
#
TRUNCATE TABLE t5;
ALTER TABLE t6 TRUNCATE PARTITION p2;
ALTER TABLE t7 TRUNCATE PARTITION p1;
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_DATA_DIR/test/t4.ibd
MYSQL_TMP_DIR/alt_dir/test/t6#p#p0.ibd
MYSQL_TMP_DIR/alt_dir/test/t6#p#p1.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p0#sp#s0.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p0#sp#s1.ibd
MYSQL_TMP_DIR/alt_dir/test/t5.ibd
MYSQL_TMP_DIR/alt_dir/test/t6#p#p2.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p1#sp#s2.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p1#sp#s3.ibd
INSERT INTO t5 VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
INSERT INTO t5 (SELECT 0, c2, c3, c4, c5 FROM t5);
INSERT INTO t5 (SELECT 0, c2, c3, c4, c5 FROM t5);
INSERT INTO t5 (SELECT 0, c2, c3, c4, c5 FROM t5);
SELECT count(*) FROM t5;
count(*)
8
SHOW CREATE TABLE t5;
Table Create Table
t5 CREATE TABLE `t5` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000012 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
SELECT count(*) FROM t6;
count(*)
21
SHOW CREATE TABLE t6;
Table Create Table
t6 CREATE TABLE `t6` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
/*!50100 PARTITION BY HASH (c1)
(PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) */
SELECT count(*) FROM t7;
count(*)
9
SHOW CREATE TABLE t7;
Table Create Table
t7 CREATE TABLE `t7` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
/*!50100 PARTITION BY RANGE (c1)
SUBPARTITION BY HASH (c1)
(PARTITION p0 VALUES LESS THAN (10)
(SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB),
PARTITION p1 VALUES LESS THAN MAXVALUE
(SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) */
#
# Shutdown the server and make a backup of a tablespace
#
---- MYSQL_DATA_DIR/test
t4.frm
t4.ibd
t5.frm
t5.frm.bak
t5.isl
t5.isl.bak
t6#p#p0.isl
t6#p#p1.isl
t6#p#p2.isl
t6.frm
t6.par
t7#p#p0#sp#s0.isl
t7#p#p0#sp#s1.isl
t7#p#p1#sp#s2.isl
t7#p#p1#sp#s3.isl
t7.frm
t7.par
---- MYSQL_TMP_DIR/alt_dir/test
t5.ibd
t5.ibd.bak
t6#p#p0.ibd
t6#p#p1.ibd
t6#p#p2.ibd
t7#p#p0#sp#s0.ibd
t7#p#p0#sp#s1.ibd
t7#p#p1#sp#s2.ibd
t7#p#p1#sp#s3.ibd
#
# Start the server and show the tablespaces.
#
SHOW VARIABLES LIKE 'innodb_file_per_table';
Variable_name Value
innodb_file_per_table ON
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_DATA_DIR/test/t4.ibd
MYSQL_TMP_DIR/alt_dir/test/t6#p#p0.ibd
MYSQL_TMP_DIR/alt_dir/test/t6#p#p1.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p0#sp#s0.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p0#sp#s1.ibd
MYSQL_TMP_DIR/alt_dir/test/t5.ibd
MYSQL_TMP_DIR/alt_dir/test/t6#p#p2.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p1#sp#s2.ibd
MYSQL_TMP_DIR/alt_dir/test/t7#p#p1#sp#s3.ibd
SELECT count(*) FROM t5;
count(*)
8
SHOW CREATE TABLE t5;
Table Create Table
t5 CREATE TABLE `t5` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000009 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
SELECT count(*) FROM t6;
count(*)
21
SHOW CREATE TABLE t6;
Table Create Table
t6 CREATE TABLE `t6` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
/*!50100 PARTITION BY HASH (c1)
(PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) */
SELECT count(*) FROM t7;
count(*)
9
SHOW CREATE TABLE t7;
Table Create Table
t7 CREATE TABLE `t7` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
/*!50100 PARTITION BY RANGE (c1)
SUBPARTITION BY HASH (c1)
(PARTITION p0 VALUES LESS THAN (10)
(SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB),
PARTITION p1 VALUES LESS THAN MAXVALUE
(SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) */
#
# Try to rename a tablespace to a file that already exists
#
RENAME TABLE t5 TO t55;
ERROR 42S01: Table 't55' already exists
RENAME TABLE t5 TO t55;
ERROR HY000: Error on rename of './test/t5' to './test/t55' (errno: 184 "Tablespace already exists")
---- MYSQL_DATA_DIR/test
t4.frm
t4.ibd
t5.frm
t5.isl
t6#p#p0.isl
t6#p#p1.isl
t6#p#p2.isl
t6.frm
t6.par
t7#p#p0#sp#s0.isl
t7#p#p0#sp#s1.isl
t7#p#p1#sp#s2.isl
t7#p#p1#sp#s3.isl
t7.frm
t7.par
---- MYSQL_TMP_DIR/alt_dir/test
t5.ibd
t6#p#p0.ibd
t6#p#p1.ibd
t6#p#p2.ibd
t7#p#p0#sp#s0.ibd
t7#p#p0#sp#s1.ibd
t7#p#p1#sp#s2.ibd
t7#p#p1#sp#s3.ibd
#
# Rename file table and tablespace
#
RENAME TABLE t5 TO t55;
RENAME TABLE t6 TO t66;
RENAME TABLE t7 TO t77;
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_DATA_DIR/test/t4.ibd
MYSQL_TMP_DIR/alt_dir/test/t66#p#p0.ibd
MYSQL_TMP_DIR/alt_dir/test/t66#p#p1.ibd
MYSQL_TMP_DIR/alt_dir/test/t77#p#p0#sp#s0.ibd
MYSQL_TMP_DIR/alt_dir/test/t77#p#p0#sp#s1.ibd
MYSQL_TMP_DIR/alt_dir/test/t55.ibd
MYSQL_TMP_DIR/alt_dir/test/t66#p#p2.ibd
MYSQL_TMP_DIR/alt_dir/test/t77#p#p1#sp#s2.ibd
MYSQL_TMP_DIR/alt_dir/test/t77#p#p1#sp#s3.ibd
INSERT INTO t55 (SELECT 0, c2, c3, c4, c5 FROM t55);
SELECT count(*) FROM t55;
count(*)
16
SHOW CREATE TABLE t55;
Table Create Table
t55 CREATE TABLE `t55` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000024 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
INSERT INTO t66 (SELECT 0, c2, c3, c4, c5 FROM t66);
SELECT count(*) FROM t66;
count(*)
42
SHOW CREATE TABLE t66;
Table Create Table
t66 CREATE TABLE `t66` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
/*!50100 PARTITION BY HASH (c1)
(PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) */
INSERT INTO t77 (SELECT 0, c2, c3, c4, c5 FROM t77);
SELECT count(*) FROM t77;
count(*)
18
SHOW CREATE TABLE t77;
Table Create Table
t77 CREATE TABLE `t77` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
/*!50100 PARTITION BY RANGE (c1)
SUBPARTITION BY HASH (c1)
(PARTITION p0 VALUES LESS THAN (10)
(SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB),
PARTITION p1 VALUES LESS THAN MAXVALUE
(SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) */
---- MYSQL_DATA_DIR/test
t4.frm
t4.ibd
t55.frm
t55.isl
t66#p#p0.isl
t66#p#p1.isl
t66#p#p2.isl
t66.frm
t66.par
t77#p#p0#sp#s0.isl
t77#p#p0#sp#s1.isl
t77#p#p1#sp#s2.isl
t77#p#p1#sp#s3.isl
t77.frm
t77.par
---- MYSQL_TMP_DIR/alt_dir/test
t55.ibd
t66#p#p0.ibd
t66#p#p1.ibd
t66#p#p2.ibd
t77#p#p0#sp#s0.ibd
t77#p#p0#sp#s1.ibd
t77#p#p1#sp#s2.ibd
t77#p#p1#sp#s3.ibd
#
# Restart the server
#
SHOW VARIABLES LIKE 'innodb_file_per_table';
Variable_name Value
innodb_file_per_table ON
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_DATA_DIR/test/t4.ibd
MYSQL_TMP_DIR/alt_dir/test/t66#p#p0.ibd
MYSQL_TMP_DIR/alt_dir/test/t66#p#p1.ibd
MYSQL_TMP_DIR/alt_dir/test/t77#p#p0#sp#s0.ibd
MYSQL_TMP_DIR/alt_dir/test/t77#p#p0#sp#s1.ibd
MYSQL_TMP_DIR/alt_dir/test/t55.ibd
MYSQL_TMP_DIR/alt_dir/test/t66#p#p2.ibd
MYSQL_TMP_DIR/alt_dir/test/t77#p#p1#sp#s2.ibd
MYSQL_TMP_DIR/alt_dir/test/t77#p#p1#sp#s3.ibd
INSERT INTO t55 (SELECT 0, c2, c3, c4, c5 FROM t55);
SELECT count(*) FROM t55;
count(*)
32
SHOW CREATE TABLE t55;
Table Create Table
t55 CREATE TABLE `t55` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000048 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
INSERT INTO t66 (SELECT 0, c2, c3, c4, c5 FROM t66);
SELECT count(*) FROM t66;
count(*)
84
SHOW CREATE TABLE t66;
Table Create Table
t66 CREATE TABLE `t66` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
/*!50100 PARTITION BY HASH (c1)
(PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB) */
INSERT INTO t77 (SELECT 0, c2, c3, c4, c5 FROM t77);
SELECT count(*) FROM t77;
count(*)
36
SHOW CREATE TABLE t77;
Table Create Table
t77 CREATE TABLE `t77` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
/*!50100 PARTITION BY RANGE (c1)
SUBPARTITION BY HASH (c1)
(PARTITION p0 VALUES LESS THAN (10)
(SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB),
PARTITION p1 VALUES LESS THAN MAXVALUE
(SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB)) */
#
# Shutdown the server
#
#
# Move the remote tablespaces to a new location and change the ISL files
#
---- MYSQL_DATA_DIR/test
t4.frm
t4.ibd
t55.frm
t55.isl
t66#p#p0.isl
t66#p#p1.isl
t66#p#p2.isl
t66.frm
t66.par
t77#p#p0#sp#s0.isl
t77#p#p0#sp#s1.isl
t77#p#p1#sp#s2.isl
t77#p#p1#sp#s3.isl
t77.frm
t77.par
---- MYSQL_TMP_DIR/alt_dir/test
t55.ibd
t66#p#p0.ibd
t66#p#p1.ibd
t66#p#p2.ibd
t77#p#p0#sp#s0.ibd
t77#p#p0#sp#s1.ibd
t77#p#p1#sp#s2.ibd
t77#p#p1#sp#s3.ibd
---- MYSQL_TMP_DIR/new_dir/test
# Moving tablespace 't4' from MYSQL_DATA_DIR to MYSQL_TMP_DIR/new_dir
# Moving tablespace 't55' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
# Moving tablespace 't66' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
# Moving tablespace 't77' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
---- MYSQL_DATA_DIR/test
t4.frm
t4.isl
t55.frm
t55.isl
t66#p#p0.isl
t66#p#p1.isl
t66#p#p2.isl
t66.frm
t66.par
t77#p#p0#sp#s0.isl
t77#p#p0#sp#s1.isl
t77#p#p1#sp#s2.isl
t77#p#p1#sp#s3.isl
t77.frm
t77.par
---- MYSQL_TMP_DIR/alt_dir/test
---- MYSQL_TMP_DIR/new_dir/test
t4.ibd
t55.ibd
t66#p#p0.ibd
t66#p#p1.ibd
t66#p#p2.ibd
t77#p#p0#sp#s0.ibd
t77#p#p0#sp#s1.ibd
t77#p#p1#sp#s2.ibd
t77#p#p1#sp#s3.ibd
#
# Start the server and check tablespaces.
#
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_DATA_DIR/test/t4.ibd
MYSQL_TMP_DIR/new_dir/test/t66#p#p0.ibd
MYSQL_TMP_DIR/new_dir/test/t66#p#p1.ibd
MYSQL_TMP_DIR/new_dir/test/t77#p#p0#sp#s0.ibd
MYSQL_TMP_DIR/new_dir/test/t77#p#p0#sp#s1.ibd
MYSQL_TMP_DIR/new_dir/test/t55.ibd
MYSQL_TMP_DIR/new_dir/test/t66#p#p2.ibd
MYSQL_TMP_DIR/new_dir/test/t77#p#p1#sp#s2.ibd
MYSQL_TMP_DIR/new_dir/test/t77#p#p1#sp#s3.ibd
INSERT INTO t4 (SELECT 0, c2, c3, c4, c5 FROM t4);
SELECT count(*) FROM t4;
count(*)
64
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000099 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
INSERT INTO t55 (SELECT 0, c2, c3, c4, c5 FROM t55);
SELECT count(*) FROM t55;
count(*)
64
SHOW CREATE TABLE t55;
Table Create Table
t55 CREATE TABLE `t55` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000096 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC DATA DIRECTORY='MYSQL_TMP_DIR/new_dir/'
INSERT INTO t66 (SELECT 0, c2, c3, c4, c5 FROM t66);
SELECT count(*) FROM t66;
count(*)
168
SHOW CREATE TABLE t66;
Table Create Table
t66 CREATE TABLE `t66` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=179 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
/*!50100 PARTITION BY HASH (c1)
(PARTITION p0 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB,
PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB,
PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB) */
INSERT INTO t77 (SELECT 0, c2, c3, c4, c5 FROM t77);
SELECT count(*) FROM t77;
count(*)
72
SHOW CREATE TABLE t77;
Table Create Table
t77 CREATE TABLE `t77` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
/*!50100 PARTITION BY RANGE (c1)
SUBPARTITION BY HASH (c1)
(PARTITION p0 VALUES LESS THAN (10)
(SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB,
SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB),
PARTITION p1 VALUES LESS THAN MAXVALUE
(SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB,
SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/new_dir' ENGINE = InnoDB)) */
#
# Shutdown the server
#
#
# Move the remote tablespaces back to the default datadir and delete the ISL file.
#
---- MYSQL_DATA_DIR/test
t4.frm
t4.isl
t55.frm
t55.isl
t66#p#p0.isl
t66#p#p1.isl
t66#p#p2.isl
t66.frm
t66.par
t77#p#p0#sp#s0.isl
t77#p#p0#sp#s1.isl
t77#p#p1#sp#s2.isl
t77#p#p1#sp#s3.isl
t77.frm
t77.par
---- MYSQL_TMP_DIR/new_dir/test
t4.ibd
t55.ibd
t66#p#p0.ibd
t66#p#p1.ibd
t66#p#p2.ibd
t77#p#p0#sp#s0.ibd
t77#p#p0#sp#s1.ibd
t77#p#p1#sp#s2.ibd
t77#p#p1#sp#s3.ibd
# Moving 't4' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
# Moving 't55' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
# Moving 't66' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
# Moving 't77' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
---- MYSQL_DATA_DIR/test
t4.frm
t4.ibd
t55.frm
t55.ibd
t66#p#p0.ibd
t66#p#p1.ibd
t66#p#p2.ibd
t66.frm
t66.par
t77#p#p0#sp#s0.ibd
t77#p#p0#sp#s1.ibd
t77#p#p1#sp#s2.ibd
t77#p#p1#sp#s3.ibd
t77.frm
t77.par
---- MYSQL_TMP_DIR/new_dir/test
#
# Start the server and check tablespaces.
#
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_DATA_DIR/test/t4.ibd
MYSQL_DATA_DIR/test/t66#p#p0.ibd
MYSQL_DATA_DIR/test/t66#p#p1.ibd
MYSQL_DATA_DIR/test/t77#p#p0#sp#s0.ibd
MYSQL_DATA_DIR/test/t77#p#p0#sp#s1.ibd
MYSQL_DATA_DIR/test/t55.ibd
MYSQL_DATA_DIR/test/t66#p#p2.ibd
MYSQL_DATA_DIR/test/t77#p#p1#sp#s2.ibd
MYSQL_DATA_DIR/test/t77#p#p1#sp#s3.ibd
INSERT INTO t4 (SELECT 0, c2, c3, c4, c5 FROM t4);
SELECT count(*) FROM t4;
count(*)
128
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000195 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
INSERT INTO t55 (SELECT 0, c2, c3, c4, c5 FROM t55);
SELECT count(*) FROM t55;
count(*)
128
SHOW CREATE TABLE t55;
Table Create Table
t55 CREATE TABLE `t55` (
`c1` double NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000192 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
INSERT INTO t66 (SELECT 0, c2, c3, c4, c5 FROM t66);
SELECT count(*) FROM t66;
count(*)
336
SHOW CREATE TABLE t66;
Table Create Table
t66 CREATE TABLE `t66` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=347 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
/*!50100 PARTITION BY HASH (c1)
(PARTITION p0 ENGINE = InnoDB,
PARTITION p1 ENGINE = InnoDB,
PARTITION p2 ENGINE = InnoDB) */
INSERT INTO t77 (SELECT 0, c2, c3, c4, c5 FROM t77);
SELECT count(*) FROM t77;
count(*)
144
SHOW CREATE TABLE t77;
Table Create Table
t77 CREATE TABLE `t77` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(10) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL,
`c4` date DEFAULT NULL,
`c5` text,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
/*!50100 PARTITION BY RANGE (c1)
SUBPARTITION BY HASH (c1)
(PARTITION p0 VALUES LESS THAN (10)
(SUBPARTITION s0 ENGINE = InnoDB,
SUBPARTITION s1 ENGINE = InnoDB),
PARTITION p1 VALUES LESS THAN MAXVALUE
(SUBPARTITION s2 ENGINE = InnoDB,
SUBPARTITION s3 ENGINE = InnoDB)) */
#
# Cleanup
#
DROP TABLE t4;
DROP TABLE t55;
DROP TABLE t66;
DROP TABLE t77;
--innodb_sys_tablespaces
--innodb_sys_datafiles
\ No newline at end of file
# Not supported in embedded
--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.
--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
let MYSQLD_DATADIR =`SELECT @@datadir`;
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_file_format = `SELECT @@innodb_file_format`;
let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522\\t1.ibd'/;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
SET SESSION innodb_strict_mode=1;
SELECT @@SESSION.innodb_strict_mode;
DROP DATABASE IF EXISTS test_wl5522;
CREATE DATABASE test_wl5522;
# Create the table that we will use for crash recovery (during IMPORT)
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
--replace_regex /, .*).*t1.cfg/, Bad file descriptor) t1.cfg/
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
perl;
do 'include/innodb-util.inc';
ib_backup_tablespaces("test_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
perl;
do 'include/innodb-util.inc';
ib_discard_tablespaces("test_wl5522", "t1");
EOF
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
##### Before commit crash
SET SESSION debug="+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
--error 2013
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
SET SESSION debug="-d,ib_import_before_commit_crash";
#### Before commit crash
# Check that the DD is consistent after recovery
##### Before checkpoint crash
SET SESSION debug="+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
--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 'include/innodb-util.inc';
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="-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.
DROP TABLE test_wl5522.t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
SET SESSION innodb_strict_mode=1;
SELECT @@SESSION.innodb_strict_mode;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE test_wl5522.t1;
SELECT COUNT(*) FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 VALUES(400), (500), (600);
SELECT * FROM test_wl5522.t1;
DROP TABLE test_wl5522.t1;
# Test handling of internal failure error
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after reset of space id and LSN in the tablespace
SET SESSION debug="+d,ib_import_internal_error";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,ib_import_internal_error";
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
DROP TABLE test_wl5522.t1;
# Test failure after reset of space id and LSN in the tablespace
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after reset of space id and LSN in the tablespace
SET SESSION debug="+d,ib_import_reset_space_and_lsn_failure";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug="-d,ib_import_reset_space_and_lsn_failure";
# Test failure after attempting a tablespace open
SET SESSION debug="+d,ib_import_open_tablespace_failure";
--replace_regex /file: '.*t1.ibd'/'t1.ibd'/
--error ER_FILE_NOT_FOUND
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,ib_import_open_tablespace_failure";
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after ibuf check
SET SESSION debug="+d,ib_import_check_bitmap_failure";
# Need proper mapping of error codes :-(
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,ib_import_check_bitmap_failure";
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after adjusting the cluster index root page
SET SESSION debug="+d,ib_import_cluster_root_adjust_failure";
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,ib_import_cluster_root_adjust_failure";
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after importing the cluster index
SET SESSION debug="+d,ib_import_cluster_failure";
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,ib_import_cluster_failure";
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after importing the secondary index(es)
SET SESSION debug="+d,ib_import_sec_root_adjust_failure";
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,ib_import_sec_root_adjust_failure";
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after importing the cluster index
SET SESSION debug="+d,ib_import_set_max_rowid_failure";
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,ib_import_set_max_rowid_failure";
# Left over from the failed IMPORT
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test_wl5522", "t1");
EOF
DROP TABLE test_wl5522.t1;
--disable_query_log
# Enable metrics for the counters we are going to use
set global innodb_monitor_enable = purge_stop_count;
set global innodb_monitor_enable = purge_resume_count;
set global innodb_monitor_enable = ibuf_merges;
set global innodb_monitor_enable = ibuf_merges_insert;
--enable_query_log
#
# Create a large table with delete marked records, disable purge during
# the update so that we can test the IMPORT purge code.
#
CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
# Stop purge so that it doesn't remove the delete marked entries.
SET GLOBAL INNODB_PURGE_STOP_NOW=ON;
# Disable change buffer merge from the master thread, additionally
# enable aggressive flushing so that more changes are buffered.
SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES
(1, REPEAT('a', 2048), REPEAT('a', 2048)),
(2, REPEAT('b', 2048), REPEAT('b', 2048)),
(3, REPEAT('c', 2048), REPEAT('c', 2048)),
(4, REPEAT('d', 2048), REPEAT('d', 2048));
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
DELETE FROM test_wl5522.t1 WHERE c2 = 1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024);
UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024);
SHOW CREATE TABLE test_wl5522.t1;
SELECT c1, c2 FROM test_wl5522.t1;
SELECT COUNT(*) FROM test_wl5522.t1;
SELECT SUM(c2) FROM test_wl5522.t1;
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_insert' AND count = 0;
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
perl;
do 'include/innodb-util.inc';
ib_backup_tablespaces("test_wl5522", "t1");
EOF
UNLOCK TABLES;
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges' AND count > 0;
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_inserts' AND count > 0;
SET GLOBAL innodb_disable_background_merge=OFF;
# Enable normal operation
SET GLOBAL INNODB_PURGE_RUN_NOW=ON;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SELECT c1, c2 FROM test_wl5522.t1;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE test_wl5522.t1;
SELECT c1,c2 FROM test_wl5522.t1;
SELECT COUNT(*) FROM test_wl5522.t1;
SELECT SUM(c2) FROM test_wl5522.t1;
SHOW CREATE TABLE test_wl5522.t1;
DROP TABLE test_wl5522.t1;
####
# Create a table and save the tablespace and .cfg file, we need to create
# a Btree that has several levels
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
INSERT INTO test_wl5522.t1 VALUES
(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200));
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
SELECT COUNT(*) FROM test_wl5522.t1;
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
perl;
do 'include/innodb-util.inc';
ib_backup_tablespaces("test_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug="+d,ib_import_trigger_corruption_1";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,ib_import_trigger_corruption_1";
DROP TABLE test_wl5522.t1;
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test_wl5522", "t1");
EOF
#
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug="+d,buf_page_is_corrupt_failure";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
# Following alter is not failing
#--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,buf_page_is_corrupt_failure";
DROP TABLE test_wl5522.t1;
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test_wl5522", "t1");
EOF
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug="+d,ib_import_trigger_corruption_2";
--replace_regex $pathfix
--error ER_INNODB_INDEX_CORRUPT
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,ib_import_trigger_corruption_2";
DROP TABLE test_wl5522.t1;
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test_wl5522", "t1");
EOF
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug="+d,ib_import_trigger_corruption_3";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,ib_import_trigger_corruption_3";
DROP TABLE test_wl5522.t1;
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test_wl5522", "t1");
EOF
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
SET SESSION debug="+d,ib_import_create_index_failure_1";
ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
SET SESSION debug="-d,ib_import_create_index_failure_1";
DROP TABLE test_wl5522.t1;
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test_wl5522", "t1");
EOF
#
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug="+d,fil_space_create_failure";
--replace_regex $pathfix
--error ER_FILE_NOT_FOUND
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,fil_space_create_failure";
DROP TABLE test_wl5522.t1;
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test_wl5522", "t1");
EOF
#
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug="+d,dict_tf_to_fsp_flags_failure";
--replace_regex $pathfix
--error ER_FILE_NOT_FOUND
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,dict_tf_to_fsp_flags_failure";
DROP TABLE test_wl5522.t1;
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test_wl5522", "t1");
EOF
#
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug="+d,fsp_flags_is_valid_failure";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug="-d,fsp_flags_is_valid_failure";
DROP TABLE test_wl5522.t1;
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test_wl5522", "t1");
EOF
DROP DATABASE test_wl5522;
set global innodb_monitor_disable = all;
set global innodb_monitor_reset_all = all;
-- disable_warnings
set global innodb_monitor_enable = default;
set global innodb_monitor_disable = default;
set global innodb_monitor_reset = default;
set global innodb_monitor_reset_all = default;
-- enable_warnings
--disable_query_log
call mtr.add_suppression("'Resource temporarily unavailable'");
call mtr.add_suppression("Monitor ibuf_merges is already enabled");
call mtr.add_suppression("Monitor ibuf_merges_insert is already enabled");
call mtr.add_suppression("Got error -1 when reading table '.*'");
call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded.");
call mtr.add_suppression("InnoDB: Tablespace '.*' exists in the cache.*");
call mtr.add_suppression("InnoDB: Freeing existing tablespace '.*' entry from the cache with id.*");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
call mtr.add_suppression(".*There was an error writing to the meta data file.*");
call mtr.add_suppression("InnoDB: Trying to import a tablespace, but could not open the tablespace file");
call mtr.add_suppression("Unsupported tablespace format");
call mtr.add_suppression("Error in page .* of index \"GEN_CLUST_INDEX\" of table \"test_wl5522\".\"t1\"");
call mtr.add_suppression("Page is marked as free");
call mtr.add_suppression("t1.ibd: Page .* at offset .* looks corrupted");
call mtr.add_suppression("but tablespace with that id or name does not exist");
call mtr.add_suppression("Failed to find tablespace for table '\"test_wl5522\".\"t1\"' in the cache");
call mtr.add_suppression("Could not find a valid tablespace file for 'test_wl5522.*t1'");
--enable_query_log
#cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
eval SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
# Not supported in embedded
--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
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_file_format = `SELECT @@innodb_file_format`;
let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
SET SESSION innodb_strict_mode=1;
SELECT @@SESSION.innodb_strict_mode;
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
let $MYSQLD_DATADIR = `SELECT @@datadir`;
CREATE TABLE t1
(a INT AUTO_INCREMENT PRIMARY KEY,
b char(22),
c varchar(255),
KEY (b))
ENGINE = InnoDB ROW_FORMAT=COMPRESSED ;
insert into t1 (b, c) values ('Apa', 'Filler........'),
('Banan', 'Filler........'), ('Cavalry', '..asdasdfaeraf'),
('Devotion', 'asdfuihknaskdf'), ('Evolution', 'lsjndofiabsoibeg');
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;
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;
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;
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;
--list_files $MYSQLD_DATADIR/test
--echo # Restarting server
-- source include/restart_mysqld.inc
--echo # Done restarting server
FLUSH TABLE t1 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
UNLOCK TABLES;
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;
--echo # Restarting server
-- source include/restart_mysqld.inc
--echo # Done restarting server
--echo # List before t1 DISCARD
--list_files $MYSQLD_DATADIR/test
ALTER TABLE t1 DISCARD TABLESPACE;
--echo # List after t1 DISCARD
--list_files $MYSQLD_DATADIR/test
--copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg
--copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd
ALTER TABLE t1 IMPORT TABLESPACE;
ALTER TABLE t1 ENGINE InnoDB;
SELECT COUNT(*) FROM t1;
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
--list_files $MYSQLD_DATADIR/test
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
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
# restore session variable
SET SESSION innodb_strict_mode=1;
SELECT @@SESSION.innodb_strict_mode;
let MYSQLD_DATADIR =`SELECT @@datadir`;
# Try importing when tablespace already exists
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
INSERT INTO t1(c2) VALUES(1);
--error ER_TABLESPACE_EXISTS
ALTER TABLE t1 IMPORT TABLESPACE;
SELECT * FROM t1;
DROP TABLE t1;
# Export/import on the same instance, with --innodb-file-per-table=1
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
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;
--list_files $MYSQLD_DATADIR/test
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1;
perl;
do 'include/innodb-util.inc';
ib_backup_tablespaces("test", "t1");
EOF
--list_files $MYSQLD_DATADIR/test
UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do 'include/innodb-util.inc';
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
--list_files $MYSQLD_DATADIR/test
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
SELECT COUNT(*) FROM t1;
DROP TABLE t1;
# Export/import on the same instance, with --innodb-file-per-table=1
# Insert some more records to move the LSN forward and then drop the
# table and restore
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
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;
--list_files $MYSQLD_DATADIR/test
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1;
perl;
do 'include/innodb-util.inc';
ib_backup_tablespaces("test", "t1");
EOF
--list_files $MYSQLD_DATADIR/test
UNLOCK TABLES;
--list_files $MYSQLD_DATADIR/test
# Move the LSN forward
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do 'include/innodb-util.inc';
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
--list_files $MYSQLD_DATADIR/test
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
SELECT COUNT(*) FROM t1;
DROP TABLE t1;
# Export/import on the same instance, with --innodb-file-per-table=1
# Insert some more records to move the LSN forward and then drop the
# table and restore, this time the table has a secondary index too.
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
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;
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1 WHERE c2 = 1;
perl;
do 'include/innodb-util.inc';
ib_backup_tablespaces("test", "t1");
EOF
--list_files $MYSQLD_DATADIR/test
UNLOCK TABLES;
# Move the LSN forward
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
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;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do 'include/innodb-util.inc';
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
SELECT COUNT(*) FROM t1 WHERE c2 = 1;
DROP TABLE t1;
# Export/import on the same instance, with --innodb-file-per-table=1
# Insert some more records to move the LSN forward and then drop the
# 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(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
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;
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1 WHERE c2 = 1;
perl;
do 'include/innodb-util.inc';
ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
# Move the LSN forward
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE t1;
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;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do 'include/innodb-util.inc';
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
# This is really a name mismatch error, need better error codes.
-- error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
ALTER TABLE t1 DROP INDEX x;
ALTER TABLE t1 ADD INDEX idx(c2);
perl;
do 'include/innodb-util.inc';
ib_restore_tablespaces("test", "t1");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
SELECT * FROM t1;
perl;
do 'include/innodb-util.inc';
ib_cleanup("test", "t1");
EOF
DROP TABLE t1;
#
# Export/import on the same instance, with --innodb-file-per-table=0
# This should fail because it is not supported
SET GLOBAL innodb_file_per_table = 0;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
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;
SELECT COUNT(*) FROM t1;
SHOW CREATE TABLE t1;
# This should fail, InnoDB should return a warning
FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
DROP TABLE t1;
#
# Tests that check for schema mismatch during IMPORT
#
SET GLOBAL innodb_file_per_table = 1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
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;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
perl;
do 'include/innodb-util.inc';
ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
DROP TABLE t1;
# Table without the secondary index
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do 'include/innodb-util.inc';
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
# This should fail because of a missing secondary index
-- error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test", "t1");
EOF
DROP TABLE t1;
# Table with an additional column
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT,
c3 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do 'include/innodb-util.inc';
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
# This should fail because the table has an additional column
-- error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test", "t1");
EOF
DROP TABLE t1;
# Change the column type of c2
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do 'include/innodb-util.inc';
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
# This should fail because c2 is now a BIGINT and not INT
-- error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test", "t1");
EOF
DROP TABLE t1;
# This should fail because KEY_BLOCK_SIZE is different
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;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do 'include/innodb-util.inc';
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
# Need better error message for following
--replace_regex /\(.*\)//
-- error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do 'include/innodb-util.inc';
ib_unlink_tablespace("test", "t1");
EOF
DROP TABLE t1;
# This should be OK.
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do 'include/innodb-util.inc';
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
perl;
do 'include/innodb-util.inc';
ib_cleanup("test", "t1");
EOF
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
call mtr.add_suppression("Got error -1 when reading table '.*'");
call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
# cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
eval SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
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