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