| 1 |
# |
| 2 |
# CREATE TABLESPACE related tests requiring a debug build. |
| 3 |
# |
| 4 |
|
| 5 |
--source include/have_debug.inc |
| 6 |
--source include/not_valgrind.inc |
| 7 |
|
| 8 |
SET DEFAULT_STORAGE_ENGINE=InnoDB; |
| 9 |
|
| 10 |
# Set these up for show_i_s_tablespaces.inc |
| 11 |
LET $MYSQLD_DATADIR = `select @@datadir`; |
| 12 |
LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`; |
| 13 |
|
| 14 |
--echo # |
| 15 |
--echo # If CREATE TABLESPACE fails after the file is created, it should not remain. |
| 16 |
--echo # |
| 17 |
SET SESSION DEBUG='+d,innodb_fail_to_update_tablespace_dict'; |
| 18 |
--error ER_CREATE_FILEGROUP_FAILED |
| 19 |
CREATE TABLESPACE s_def ADD DATAFILE 's_def.ibd' ENGINE=InnoDB; |
| 20 |
SET SESSION DEBUG='-d,innodb_fail_to_update_tablespace_dict'; |
| 21 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 22 |
--echo # MYSQLD_DATADIR/ |
| 23 |
--list_files $MYSQLD_DATADIR/ *.ibd |
| 24 |
--error ER_TABLESPACE_MISSING_WITH_NAME |
| 25 |
DROP TABLESPACE s_def; |
| 26 |
|
| 27 |
--echo # |
| 28 |
--echo # Assigning general tablespace to myisam,memory is igonred |
| 29 |
--echo # |
| 30 |
USE test; |
| 31 |
CREATE TABLESPACE s1 ADD DATAFILE 's1.ibd' ENGINE InnoDB; |
| 32 |
CREATE TABLE t1 (a int) ENGINE=innodb TABLESPACE=s1; |
| 33 |
CREATE TABLE t2 (a int) ENGINE=memory TABLESPACE=s1; |
| 34 |
CREATE TABLE t3 (a int) ENGINE=myisam TABLESPACE=s1; |
| 35 |
INSERT INTO t1 VALUES ( 11); |
| 36 |
INSERT INTO t2 VALUES ( 21); |
| 37 |
INSERT INTO t3 VALUES ( 31); |
| 38 |
|
| 39 |
--source suite/innodb/include/show_i_s_tables.inc |
| 40 |
ALTER TABLE t2 TABLESPACE=s1; |
| 41 |
ALTER TABLE t3 TABLESPACE=s1; |
| 42 |
--source suite/innodb/include/show_i_s_tables.inc |
| 43 |
|
| 44 |
--echo # MYSQLD_DATADIR/ |
| 45 |
--list_files $MYSQLD_DATADIR/ *.ibd |
| 46 |
show tables; |
| 47 |
--echo #restart the server |
| 48 |
--source include/restart_mysqld.inc |
| 49 |
USE test; |
| 50 |
show tables; |
| 51 |
select * from t1; |
| 52 |
select * from t2; |
| 53 |
select * from t3; |
| 54 |
DROP TABLE t2,t3; |
| 55 |
|
| 56 |
--echo # |
| 57 |
--echo # A general tablespace and its contents can be recovered. |
| 58 |
--echo # |
| 59 |
CREATE TABLE t2 (a int) ENGINE=innodb TABLESPACE=s1; |
| 60 |
CREATE TABLE t3 (a int) ENGINE=innodb TABLESPACE=innodb_system; |
| 61 |
CREATE TABLE t4 (a int) ENGINE=innodb TABLESPACE=innodb_file_per_table; |
| 62 |
INSERT INTO t2 VALUES (21); |
| 63 |
INSERT INTO t3 VALUES (31); |
| 64 |
INSERT INTO t4 VALUES (41); |
| 65 |
BEGIN; |
| 66 |
INSERT INTO t1 VALUES (12); |
| 67 |
INSERT INTO t2 VALUES (22); |
| 68 |
INSERT INTO t3 VALUES (32); |
| 69 |
INSERT INTO t4 VALUES (42); |
| 70 |
--source suite/innodb/include/show_i_s_tables.inc |
| 71 |
--source include/kill_and_restart_mysqld.inc |
| 72 |
--source suite/innodb/include/show_i_s_tables.inc |
| 73 |
select * from t1; |
| 74 |
select * from t2; |
| 75 |
select * from t3; |
| 76 |
select * from t4; |
| 77 |
SHOW CREATE TABLE t1; |
| 78 |
SHOW CREATE TABLE t2; |
| 79 |
SHOW CREATE TABLE t3; |
| 80 |
SHOW CREATE TABLE t4; |
| 81 |
|
| 82 |
BEGIN; |
| 83 |
INSERT INTO t1 VALUES (13); |
| 84 |
INSERT INTO t2 VALUES (23); |
| 85 |
INSERT INTO t3 VALUES (33); |
| 86 |
INSERT INTO t4 VALUES (43); |
| 87 |
RENAME TABLE t1 TO tr1; |
| 88 |
RENAME TABLE t2 TO tr2; |
| 89 |
RENAME TABLE t3 TO tr3; |
| 90 |
RENAME TABLE t4 TO tr4; |
| 91 |
--source suite/innodb/include/show_i_s_tables.inc |
| 92 |
--source include/kill_and_restart_mysqld.inc |
| 93 |
--source suite/innodb/include/show_i_s_tables.inc |
| 94 |
select * from tr1; |
| 95 |
select * from tr2; |
| 96 |
select * from tr3; |
| 97 |
select * from tr4; |
| 98 |
SHOW CREATE TABLE tr1; |
| 99 |
SHOW CREATE TABLE tr2; |
| 100 |
SHOW CREATE TABLE tr3; |
| 101 |
SHOW CREATE TABLE tr4; |
| 102 |
|
| 103 |
DROP TABLE tr1,tr2,tr3,tr4; |
| 104 |
DROP TABLESPACE s1; |
| 105 |
|
| 106 |
|
| 107 |
# Test for WL#5989 Support InnoDB tablespace version in se_private_data of mysql.tablespaces |
| 108 |
# Check every row has version=<num> format , we not extracting exact <num> for comparison. |
| 109 |
# [We are checking version is correct through information_schema.innodb_tablespaces] |
| 110 |
SET SESSION debug= '+d,skip_dd_table_access_check'; |
| 111 |
SELECT count(*) INTO @dd_tbs_row_cnt FROM mysql.tablespaces; |
| 112 |
SELECT count(*) INTO @matching_dd_tbs_row_cnt FROM mysql.tablespaces WHERE se_private_data RLIKE 'version=[0-9]+;'; |
| 113 |
# This should return 1 |
| 114 |
SELECT @dd_tbs_row_cnt = @matching_dd_tbs_row_cnt ; |
| 115 |
# Extract version |
| 116 |
SELECT CONCAT(sys.version_major(),".",sys.version_minor(),".",sys.version_patch()) INTO @server_version; |
| 117 |
SELECT count(*) INTO @is_tbs_row_cnt FROM information_schema.innodb_tablespaces; |
| 118 |
# match version in information_schema.innodb_tablespaces and confirm all rows has same version |
| 119 |
SELECT count(*) INTO @matching_is_tbs_row_cnt FROM information_schema.innodb_tablespaces WHERE server_version LIKE CONCAT('%',@server_version,'%'); |
| 120 |
# This should return 1 |
| 121 |
SELECT @is_tbs_row_cnt = @matching_is_tbs_row_cnt ; |
| 122 |
|
| 123 |
--disable_query_log |
| 124 |
call mtr.add_suppression("\\[ERROR\\].* Operating system error number .* in a file operation"); |
| 125 |
call mtr.add_suppression("\\[ERROR\\].* The error means that another program is using InnoDB's files"); |
| 126 |
call mtr.add_suppression("\\[ERROR\\].* The error means the system cannot find the path specified."); |
| 127 |
call mtr.add_suppression("\\[ERROR\\].* Cannot open datafile for read-only"); |
| 128 |
call mtr.add_suppression("\\[ERROR\\].* Could not find a valid tablespace file for"); |
| 129 |
call mtr.add_suppression("\\[ERROR\\].* File .*s_def.ibd: 'delete' returned OS error [0-9]*"); |
| 130 |
call mtr.add_suppression("\\[ERROR\\].* Failed to delete the datafile of tablespace ID=[0-9]+, file '.*s_def.ibd'!"); |
| 131 |
call mtr.add_suppression("\\[ERROR\\].* Attempted to open a previously opened tablespace. Previous tablespace innodb_general_[0-9]* at filepath: .*s1.ibd uses space ID: [0-9]*. Cannot open filepath: .*s1.ibd which uses the same space ID."); |
| 132 |
call mtr.add_suppression("\\[ERROR\\].* If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them."); |
| 133 |
call mtr.add_suppression("\\[ERROR\\].* Tablespace [0-9]+, name '.*test.*t[0-9]+', unable to open file '.*test.*t[0-4]+.ibd' - Data structure corruption"); |
| 134 |
--enable_query_log |