135 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			135 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
#
 | 
						|
# 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 [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
 |