717 lines
25 KiB
Plaintext
717 lines
25 KiB
Plaintext
#
|
|
# Non-Windows version of Tablespace Portability test.
|
|
#
|
|
# This testcase is related to WL#5980 & WL#6205.
|
|
# It tests whether datafiles can be copied from one location
|
|
# to another, and still be opened. In order to make this testcase run
|
|
# on any OS, we create the tablespaces here.
|
|
#
|
|
SET DEFAULT_STORAGE_ENGINE=InnoDB;
|
|
#
|
|
# Try to create a tablespace in a read-only directory.
|
|
#
|
|
CREATE TABLESPACE s7_def ADD DATAFILE 'MYSQL_TMP_DIR/read_only_dir/s7.ibd';
|
|
ERROR HY000: Failed to create TABLESPACE s7_def
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 1528 Failed to create TABLESPACE s7_def
|
|
Error 1030 Got error 168 from storage engine
|
|
#
|
|
# Try a series of invalid relative ADD DATAFILE entries.
|
|
# General tablespace files can be in the datadir but they cannot be under the datadir.
|
|
#
|
|
CREATE TABLESPACE bad ADD DATAFILE '';
|
|
ERROR HY000: Incorrect File Name ''.
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 3121 Incorrect File Name ''.
|
|
Error 1528 Failed to create TABLESPACE bad
|
|
Error 1031 Table storage engine for 'bad' doesn't have this option
|
|
CREATE TABLESPACE bad ADD DATAFILE '.ibd';
|
|
ERROR HY000: Incorrect File Name '.ibd'.
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 3121 Incorrect File Name '.ibd'.
|
|
Error 1528 Failed to create TABLESPACE bad
|
|
Error 1031 Table storage engine for 'bad' doesn't have this option
|
|
CREATE TABLESPACE bad ADD DATAFILE './ibd';
|
|
ERROR HY000: Incorrect File Name './ibd'.
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 3121 Incorrect File Name './ibd'.
|
|
Error 1528 Failed to create TABLESPACE bad
|
|
Error 1031 Table storage engine for 'bad' doesn't have this option
|
|
CREATE TABLESPACE bad ADD DATAFILE './.ibd';
|
|
ERROR HY000: Incorrect File Name './.ibd'.
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 3121 Incorrect File Name './.ibd'.
|
|
Error 1528 Failed to create TABLESPACE bad
|
|
Error 1031 Table storage engine for 'bad' doesn't have this option
|
|
CREATE TABLESPACE bad ADD DATAFILE '../spaces/';
|
|
ERROR HY000: Incorrect File Name '../spaces/'.
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 3121 Incorrect File Name '../spaces/'.
|
|
Error 1528 Failed to create TABLESPACE bad
|
|
Error 1031 Table storage engine for 'bad' doesn't have this option
|
|
CREATE TABLESPACE bad ADD DATAFILE 'test/bad.ibd';
|
|
ERROR HY000: Incorrect File Name 'test/bad.ibd'.
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 3121 Incorrect File Name 'test/bad.ibd'.
|
|
Error 3121 CREATE TABLESPACE data file cannot be under the datadir.
|
|
Error 1528 Failed to create TABLESPACE bad
|
|
Error 1031 Table storage engine for 'bad' doesn't have this option
|
|
CREATE TABLESPACE bad ADD DATAFILE './test/bad.ibd';
|
|
ERROR HY000: Incorrect File Name './test/bad.ibd'.
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 3121 Incorrect File Name './test/bad.ibd'.
|
|
Error 3121 CREATE TABLESPACE data file cannot be under the datadir.
|
|
Error 1528 Failed to create TABLESPACE bad
|
|
Error 1031 Table storage engine for 'bad' doesn't have this option
|
|
CREATE TABLESPACE bad ADD DATAFILE './test//bad.ibd';
|
|
ERROR HY000: Incorrect File Name './test//bad.ibd'.
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 3121 Incorrect File Name './test//bad.ibd'.
|
|
Error 3121 CREATE TABLESPACE data file cannot be under the datadir.
|
|
Error 1528 Failed to create TABLESPACE bad
|
|
Error 1031 Table storage engine for 'bad' doesn't have this option
|
|
CREATE TABLESPACE bad ADD DATAFILE '../data/test/bad.ibd';
|
|
ERROR HY000: Incorrect File Name '../data/test/bad.ibd'.
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 3121 Incorrect File Name '../data/test/bad.ibd'.
|
|
Error 3121 CREATE TABLESPACE data file cannot be under the datadir.
|
|
Error 1528 Failed to create TABLESPACE bad
|
|
Error 1031 Table storage engine for 'bad' doesn't have this option
|
|
CREATE TABLESPACE bad ADD DATAFILE '../data/../data/test/bad.ibd';
|
|
ERROR HY000: Incorrect File Name '../data/../data/test/bad.ibd'.
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 3121 Incorrect File Name '../data/../data/test/bad.ibd'.
|
|
Error 3121 CREATE TABLESPACE data file cannot be under the datadir.
|
|
Error 1528 Failed to create TABLESPACE bad
|
|
Error 1031 Table storage engine for 'bad' doesn't have this option
|
|
CREATE TABLESPACE bad ADD DATAFILE '../does_not_exist/bad.ibd';
|
|
ERROR HY000: Incorrect File Name '../does_not_exist/bad.ibd'.
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 3121 Incorrect File Name '../does_not_exist/bad.ibd'.
|
|
Error 3121 The directory does not exist.
|
|
Error 1528 Failed to create TABLESPACE bad
|
|
Error 1031 Table storage engine for 'bad' doesn't have this option
|
|
#
|
|
# Try a series of valid relative ADD DATAFILE entries.
|
|
# General tablespace files can be in the datadir but they cannot be under the datadir.
|
|
#
|
|
CREATE TABLESPACE ibport_s01 ADD DATAFILE 'ibport_s01.ibd';
|
|
CREATE TABLESPACE ibport_s02 ADD DATAFILE './ibport_s02.ibd';
|
|
CREATE TABLESPACE ibport_s03 ADD DATAFILE '../data/ibport_s03.ibd';
|
|
CREATE TABLESPACE ibport_s04 ADD DATAFILE 'test/../ibport_s04.ibd';
|
|
CREATE TABLESPACE ibport_s05 ADD DATAFILE './test/../ibport_s05.ibd';
|
|
CREATE TABLESPACE ibport_s06 ADD DATAFILE '..///data//test///..//ibport_s06.ibd';
|
|
CREATE TABLESPACE ibport_s12 ADD DATAFILE '.\\ibport_s12.ibd';
|
|
CREATE TABLESPACE ibport_s13 ADD DATAFILE '..\\data\\ibport_s13.ibd';
|
|
CREATE TABLESPACE ibport_s14 ADD DATAFILE 'test\\..\\ibport_s14.ibd';
|
|
CREATE TABLESPACE ibport_s15 ADD DATAFILE '.\\test\\..\\ibport_s15.ibd';
|
|
CREATE TABLESPACE ibport_s16 ADD DATAFILE '..\\\\\\data\\\\test\\\\\\..\\\\ibport_s16.ibd';
|
|
# Directory listing of MYSQLD_DATADIR/ ibport*
|
|
ibport_s01.ibd
|
|
ibport_s02.ibd
|
|
ibport_s03.ibd
|
|
ibport_s04.ibd
|
|
ibport_s05.ibd
|
|
ibport_s06.ibd
|
|
ibport_s12.ibd
|
|
ibport_s13.ibd
|
|
ibport_s14.ibd
|
|
ibport_s15.ibd
|
|
ibport_s16.ibd
|
|
SELECT s.space_type 'Type', s.name 'Space Name', d.path 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.innodb_sys_datafiles d
|
|
WHERE s.name like '%ibport%' AND s.space = d.space ORDER BY s.space;
|
|
Type Space Name Path
|
|
General ibport_s01 ./ibport_s01.ibd
|
|
General ibport_s02 ./ibport_s02.ibd
|
|
General ibport_s03 ../data/ibport_s03.ibd
|
|
General ibport_s04 ./test/../ibport_s04.ibd
|
|
General ibport_s05 ./test/../ibport_s05.ibd
|
|
General ibport_s06 ..///data//test///..//ibport_s06.ibd
|
|
General ibport_s12 ./ibport_s12.ibd
|
|
General ibport_s13 ../data/ibport_s13.ibd
|
|
General ibport_s14 ./test/../ibport_s14.ibd
|
|
General ibport_s15 ./test/../ibport_s15.ibd
|
|
General ibport_s16 ..///data//test///..//ibport_s16.ibd
|
|
SELECT s.space_type 'Type', s.name 'Space Name', f.file_name 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.files f
|
|
WHERE s.name like '%ibport%' AND s.space = f.file_id ORDER BY s.space;
|
|
Type Space Name Path
|
|
General ibport_s01 ./ibport_s01.ibd
|
|
General ibport_s02 ./ibport_s02.ibd
|
|
General ibport_s03 ../data/ibport_s03.ibd
|
|
General ibport_s04 ./test/../ibport_s04.ibd
|
|
General ibport_s05 ./test/../ibport_s05.ibd
|
|
General ibport_s06 ..///data//test///..//ibport_s06.ibd
|
|
General ibport_s12 ./ibport_s12.ibd
|
|
General ibport_s13 ../data/ibport_s13.ibd
|
|
General ibport_s14 ./test/../ibport_s14.ibd
|
|
General ibport_s15 ./test/../ibport_s15.ibd
|
|
General ibport_s16 ..///data//test///..//ibport_s16.ibd
|
|
DROP TABLESPACE ibport_s01;
|
|
DROP TABLESPACE ibport_s02;
|
|
DROP TABLESPACE ibport_s03;
|
|
DROP TABLESPACE ibport_s04;
|
|
DROP TABLESPACE ibport_s05;
|
|
DROP TABLESPACE ibport_s06;
|
|
DROP TABLESPACE ibport_s12;
|
|
DROP TABLESPACE ibport_s13;
|
|
DROP TABLESPACE ibport_s14;
|
|
DROP TABLESPACE ibport_s15;
|
|
DROP TABLESPACE ibport_s16;
|
|
#
|
|
# Create the sample database to test for portability.
|
|
#
|
|
CREATE TABLE ibport_t1 (a INT, b varchar(30), c int, key ka(a), key kb(b)) ENGINE=InnoDB;
|
|
INSERT INTO ibport_t1 VALUES (1, 'One', 11), (2, 'two', 22), (3, 'three', 33), (4, 'four', 44);
|
|
CREATE TABLESPACE ibport_s1 ADD DATAFILE 'ibport_s1_gen.ibd' ENGINE=InnoDB;
|
|
CREATE TABLE ibport_t5 (a INT, b varchar(30), c int, key ka(a), key kb(b)) ENGINE=InnoDB TABLESPACE ibport_s1;
|
|
INSERT INTO ibport_t5 VALUES (1, 'One', 11), (2, 'two', 22), (3, 'three', 33), (4, 'four', 44);
|
|
CREATE TABLESPACE ibport_s2 ADD DATAFILE '../spaces/ibport_s2_gen.ibd' ENGINE=InnoDB FILE_BLOCK_SIZE=4k;
|
|
CREATE TABLE ibport_t6 (a INT, b varchar(30), c int, key ka(a), key kb(b)) ENGINE=InnoDB TABLESPACE ibport_s2
|
|
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
|
|
INSERT INTO ibport_t6 VALUES (1, 'One', 11), (2, 'two', 22), (3, 'three', 33), (4, 'four', 44);
|
|
SELECT s.space_type 'Type', s.name 'Space Name', d.path 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.innodb_sys_datafiles d
|
|
WHERE s.name like '%ibport%' AND s.space = d.space ORDER BY s.space;
|
|
Type Space Name Path
|
|
Single test/ibport_t1 ./test/ibport_t1.ibd
|
|
General ibport_s1 ./ibport_s1_gen.ibd
|
|
General ibport_s2 ../spaces/ibport_s2_gen.ibd
|
|
SELECT s.space_type 'Type', s.name 'Space Name', f.file_name 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.files f
|
|
WHERE s.name like '%ibport%' AND s.space = f.file_id ORDER BY s.space;
|
|
Type Space Name Path
|
|
Single test/ibport_t1 ./test/ibport_t1.ibd
|
|
General ibport_s1 ./ibport_s1_gen.ibd
|
|
General ibport_s2 ../spaces/ibport_s2_gen.ibd
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.frm
|
|
ibport_t1.frm
|
|
ibport_t5.frm
|
|
ibport_t6.frm
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.isl
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.ibd
|
|
ibport_t1.ibd
|
|
# Directory listing of MYSQLD_DATADIR/ ibport*.isl
|
|
ibport_s2_gen.isl
|
|
# Directory listing of MYSQLD_DATADIR/ ibport*.ibd
|
|
ibport_s1_gen.ibd
|
|
# Directory listing of ../spaces/ ibport*
|
|
ibport_s2_gen.ibd
|
|
# Add some uncommitted records to these tablespaces before clean shutdown
|
|
INSERT INTO ibport_t1 VALUES (5, 'Five', 55);
|
|
INSERT INTO ibport_t5 VALUES (5, 'Five', 55);
|
|
INSERT INTO ibport_t6 VALUES (5, 'Five', 55);
|
|
BEGIN;
|
|
UPDATE ibport_t1 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
UPDATE ibport_t5 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
UPDATE ibport_t6 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
DELETE FROM ibport_t1 WHERE a = 3;
|
|
DELETE FROM ibport_t5 WHERE a = 3;
|
|
DELETE FROM ibport_t6 WHERE a = 3;
|
|
#
|
|
# Shutdown the server and replace the relative paths in the ISL files with
|
|
# full paths to these locations. This makes the SYS_DATAFILES.PATH and the
|
|
# ISL path look different but point to the same place. InnoDB should
|
|
# recognize that they point to the same file and update SYS_DATAFILES.PATH.
|
|
#
|
|
# Put the full path to the *.ibd files into *.isl files.
|
|
# Restart the DB server.
|
|
# Show that the tables are open and the full paths are in SYS_DATAFILES.
|
|
# restart
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.frm
|
|
ibport_t1.frm
|
|
ibport_t5.frm
|
|
ibport_t6.frm
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.isl
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.ibd
|
|
ibport_t1.ibd
|
|
# Directory listing of MYSQLD_DATADIR/ ibport*.isl
|
|
ibport_s2_gen.isl
|
|
# Directory listing of MYSQLD_DATADIR/ ibport*.ibd
|
|
ibport_s1_gen.ibd
|
|
# Directory listing of ../spaces/ ibport*
|
|
ibport_s2_gen.ibd
|
|
SELECT * FROM ibport_t1 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
SELECT * FROM ibport_t5 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
SELECT * FROM ibport_t6 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
SELECT s.space_type 'Type', s.name 'Space Name', d.path 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.innodb_sys_datafiles d
|
|
WHERE s.name like '%ibport%' AND s.space = d.space ORDER BY s.space;
|
|
Type Space Name Path
|
|
Single test/ibport_t1 ./test/ibport_t1.ibd
|
|
General ibport_s1 ./ibport_s1_gen.ibd
|
|
General ibport_s2 ../spaces/ibport_s2_gen.ibd
|
|
SELECT s.space_type 'Type', s.name 'Space Name', f.file_name 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.files f
|
|
WHERE s.name like '%ibport%' AND s.space = f.file_id ORDER BY s.space;
|
|
Type Space Name Path
|
|
Single test/ibport_t1 ./test/ibport_t1.ibd
|
|
General ibport_s1 ./ibport_s1_gen.ibd
|
|
General ibport_s2 ../spaces/ibport_s2_gen.ibd
|
|
SHOW CREATE TABLE ibport_t1;
|
|
Table Create Table
|
|
ibport_t1 CREATE TABLE `ibport_t1` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW CREATE TABLE ibport_t5;
|
|
Table Create Table
|
|
ibport_t5 CREATE TABLE `ibport_t5` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) /*!50100 TABLESPACE `ibport_s1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW CREATE TABLE ibport_t6;
|
|
Table Create Table
|
|
ibport_t6 CREATE TABLE `ibport_t6` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) /*!50100 TABLESPACE `ibport_s2` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4
|
|
# Add some uncommitted records to these tablespaces before clean shutdown
|
|
INSERT INTO ibport_t1 VALUES (6, 'Six', 66);
|
|
INSERT INTO ibport_t5 VALUES (6, 'Six', 66);
|
|
INSERT INTO ibport_t6 VALUES (6, 'Six', 66);
|
|
BEGIN;
|
|
UPDATE ibport_t1 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
UPDATE ibport_t5 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
UPDATE ibport_t6 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
DELETE FROM ibport_t1 WHERE a = 3;
|
|
DELETE FROM ibport_t5 WHERE a = 3;
|
|
DELETE FROM ibport_t6 WHERE a = 3;
|
|
# Stop server
|
|
#
|
|
# Move all the datafiles to a new location and update the isl files.
|
|
#
|
|
# Replace the *.isl files with the full path to the *.ibd files
|
|
# Directory listing of MYSQLD_DATADIR/ ibport*
|
|
ibport_s1_gen.isl
|
|
ibport_s2_gen.isl
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.frm
|
|
ibport_t1.frm
|
|
ibport_t5.frm
|
|
ibport_t6.frm
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.isl
|
|
ibport_t1.isl
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.ibd
|
|
# Directory listing of MYSQL_TMP_DIR/portability/tables/ ibport*
|
|
ibport_t1.ibd
|
|
# Directory listing of MYSQL_TMP_DIR/portability/spaces/ ibport*
|
|
ibport_s1_gen.ibd
|
|
ibport_s2_gen.ibd
|
|
# Start the DB server
|
|
# restart
|
|
SELECT * FROM ibport_t1 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
6 Six 66
|
|
SELECT * FROM ibport_t5 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
6 Six 66
|
|
SELECT * FROM ibport_t6 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
6 Six 66
|
|
SELECT s.space_type 'Type', s.name 'Space Name', d.path 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.innodb_sys_datafiles d
|
|
WHERE s.name like '%ibport%' AND s.space = d.space ORDER BY s.space;
|
|
Type Space Name Path
|
|
Single test/ibport_t1 MYSQL_TMP_DIR/portability/tables/ibport_t1.ibd
|
|
General ibport_s1 MYSQL_TMP_DIR/portability/spaces/ibport_s1_gen.ibd
|
|
General ibport_s2 MYSQL_TMP_DIR/portability/spaces/ibport_s2_gen.ibd
|
|
SELECT s.space_type 'Type', s.name 'Space Name', f.file_name 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.files f
|
|
WHERE s.name like '%ibport%' AND s.space = f.file_id ORDER BY s.space;
|
|
Type Space Name Path
|
|
Single test/ibport_t1 MYSQL_TMP_DIR/portability/tables/ibport_t1.ibd
|
|
General ibport_s1 MYSQL_TMP_DIR/portability/spaces/ibport_s1_gen.ibd
|
|
General ibport_s2 MYSQL_TMP_DIR/portability/spaces/ibport_s2_gen.ibd
|
|
SHOW CREATE TABLE ibport_t1;
|
|
Table Create Table
|
|
ibport_t1 CREATE TABLE `ibport_t1` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW CREATE TABLE ibport_t5;
|
|
Table Create Table
|
|
ibport_t5 CREATE TABLE `ibport_t5` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) /*!50100 TABLESPACE `ibport_s1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW CREATE TABLE ibport_t6;
|
|
Table Create Table
|
|
ibport_t6 CREATE TABLE `ibport_t6` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) /*!50100 TABLESPACE `ibport_s2` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4
|
|
# Add some uncommitted records to these tablespaces before clean shutdown
|
|
INSERT INTO ibport_t1 VALUES (7, 'Seven', 77);
|
|
INSERT INTO ibport_t5 VALUES (7, 'Seven', 77);
|
|
INSERT INTO ibport_t6 VALUES (7, 'Seven', 77);
|
|
BEGIN;
|
|
UPDATE ibport_t1 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
UPDATE ibport_t5 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
UPDATE ibport_t6 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
DELETE FROM ibport_t1 WHERE a = 3;
|
|
DELETE FROM ibport_t5 WHERE a = 3;
|
|
DELETE FROM ibport_t6 WHERE a = 3;
|
|
#
|
|
# Shutdown the server again and move each of the tablespaces to
|
|
# a common location and update the ISL files accordingly.
|
|
#
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.frm
|
|
ibport_t1.frm
|
|
ibport_t5.frm
|
|
ibport_t6.frm
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.isl
|
|
ibport_t1.isl
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.ibd
|
|
# Directory listing of MYSQL_TMP_DIR/portability/altogether/
|
|
ibport_s1_gen.ibd
|
|
ibport_s2_gen.ibd
|
|
ibport_t1.ibd
|
|
# Start the DB server
|
|
# restart
|
|
SELECT s.space_type 'Type', s.name 'Space Name', d.path 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.innodb_sys_datafiles d
|
|
WHERE s.name like '%ibport%' AND s.space = d.space ORDER BY s.space;
|
|
Type Space Name Path
|
|
Single test/ibport_t1 MYSQL_TMP_DIR/portability/altogether/ibport_t1.ibd
|
|
General ibport_s1 MYSQL_TMP_DIR/portability/altogether/ibport_s1_gen.ibd
|
|
General ibport_s2 MYSQL_TMP_DIR/portability/altogether/ibport_s2_gen.ibd
|
|
SELECT s.space_type 'Type', s.name 'Space Name', f.file_name 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.files f
|
|
WHERE s.name like '%ibport%' AND s.space = f.file_id ORDER BY s.space;
|
|
Type Space Name Path
|
|
Single test/ibport_t1 MYSQL_TMP_DIR/portability/altogether/ibport_t1.ibd
|
|
General ibport_s1 MYSQL_TMP_DIR/portability/altogether/ibport_s1_gen.ibd
|
|
General ibport_s2 MYSQL_TMP_DIR/portability/altogether/ibport_s2_gen.ibd
|
|
SHOW CREATE TABLE ibport_t1;
|
|
Table Create Table
|
|
ibport_t1 CREATE TABLE `ibport_t1` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW CREATE TABLE ibport_t5;
|
|
Table Create Table
|
|
ibport_t5 CREATE TABLE `ibport_t5` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) /*!50100 TABLESPACE `ibport_s1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW CREATE TABLE ibport_t6;
|
|
Table Create Table
|
|
ibport_t6 CREATE TABLE `ibport_t6` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) /*!50100 TABLESPACE `ibport_s2` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4
|
|
SELECT * FROM ibport_t1 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
6 Six 66
|
|
7 Seven 77
|
|
SELECT * FROM ibport_t5 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
6 Six 66
|
|
7 Seven 77
|
|
SELECT * FROM ibport_t6 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
6 Six 66
|
|
7 Seven 77
|
|
# Add some uncommitted records to these tablespaces before clean shutdown
|
|
INSERT INTO ibport_t1 VALUES (8, 'Eight', 88);
|
|
INSERT INTO ibport_t5 VALUES (8, 'Eight', 88);
|
|
INSERT INTO ibport_t6 VALUES (8, 'Eight', 88);
|
|
BEGIN;
|
|
UPDATE ibport_t1 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
UPDATE ibport_t5 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
UPDATE ibport_t6 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
DELETE FROM ibport_t1 WHERE a = 3;
|
|
DELETE FROM ibport_t5 WHERE a = 3;
|
|
DELETE FROM ibport_t6 WHERE a = 3;
|
|
#
|
|
# Shutdown the server again and move each of the tablespaces to their
|
|
# default locations. Leave the ISL files and the dictionary pointing to
|
|
# the MYSQL_TMP_DIR/portability/altogether location. The dictionary
|
|
# will be adjusted when the files are found in the default locations.
|
|
# The ISL files will be ignored.
|
|
#
|
|
# Directory listing of MYSQLD_DATADIR/ ibport*.ibd
|
|
ibport_s1_gen.ibd
|
|
ibport_s2_gen.ibd
|
|
# Directory listing of MYSQLD_DATADIR/ ibport*.isl
|
|
ibport_s1_gen.isl
|
|
ibport_s2_gen.isl
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.frm
|
|
ibport_t1.frm
|
|
ibport_t5.frm
|
|
ibport_t6.frm
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.isl
|
|
ibport_t1.isl
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.ibd
|
|
ibport_t1.ibd
|
|
# Directory listing of MYSQL_TMP_DIR/portability/altogether/
|
|
# Start the DB server
|
|
# restart
|
|
SHOW CREATE TABLE ibport_t1;
|
|
Table Create Table
|
|
ibport_t1 CREATE TABLE `ibport_t1` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW CREATE TABLE ibport_t5;
|
|
Table Create Table
|
|
ibport_t5 CREATE TABLE `ibport_t5` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) /*!50100 TABLESPACE `ibport_s1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW CREATE TABLE ibport_t6;
|
|
Table Create Table
|
|
ibport_t6 CREATE TABLE `ibport_t6` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) /*!50100 TABLESPACE `ibport_s2` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4
|
|
SELECT s.space_type 'Type', s.name 'Space Name', d.path 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.innodb_sys_datafiles d
|
|
WHERE s.name like '%ibport%' AND s.space = d.space ORDER BY s.space;
|
|
Type Space Name Path
|
|
Single test/ibport_t1 ./test/ibport_t1.ibd
|
|
General ibport_s1 ./ibport_s1_gen.ibd
|
|
General ibport_s2 ./ibport_s2_gen.ibd
|
|
SELECT s.space_type 'Type', s.name 'Space Name', f.file_name 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.files f
|
|
WHERE s.name like '%ibport%' AND s.space = f.file_id ORDER BY s.space;
|
|
Type Space Name Path
|
|
Single test/ibport_t1 ./test/ibport_t1.ibd
|
|
General ibport_s1 ./ibport_s1_gen.ibd
|
|
General ibport_s2 ./ibport_s2_gen.ibd
|
|
SELECT * FROM ibport_t1 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
6 Six 66
|
|
7 Seven 77
|
|
8 Eight 88
|
|
SELECT * FROM ibport_t5 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
6 Six 66
|
|
7 Seven 77
|
|
8 Eight 88
|
|
SELECT * FROM ibport_t6 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
6 Six 66
|
|
7 Seven 77
|
|
8 Eight 88
|
|
# Add some uncommitted records to these tablespaces before clean shutdown
|
|
INSERT INTO ibport_t1 VALUES (9, 'Nine', 99);
|
|
INSERT INTO ibport_t5 VALUES (9, 'Nine', 99);
|
|
INSERT INTO ibport_t6 VALUES (9, 'Nine', 99);
|
|
BEGIN;
|
|
UPDATE ibport_t1 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
UPDATE ibport_t5 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
UPDATE ibport_t6 SET a = 99, b = 'Uncommitted' WHERE a < 3;
|
|
DELETE FROM ibport_t1 WHERE a = 3;
|
|
DELETE FROM ibport_t5 WHERE a = 3;
|
|
DELETE FROM ibport_t6 WHERE a = 3;
|
|
#
|
|
# Shutdown the server again and move each of the tablespaces to the
|
|
# original locations.
|
|
# Make the ISL files point to these locations. using relative pathnames.
|
|
# The dictionary is pointing to the default locations and will be adjusted.
|
|
#
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.frm
|
|
ibport_t1.frm
|
|
ibport_t5.frm
|
|
ibport_t6.frm
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.isl
|
|
# Directory listing of MYSQLD_DATADIR/test/ ibport*.ibd
|
|
ibport_t1.ibd
|
|
# Start the DB server
|
|
# restart
|
|
SELECT * FROM ibport_t1 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
6 Six 66
|
|
7 Seven 77
|
|
8 Eight 88
|
|
9 Nine 99
|
|
SELECT * FROM ibport_t5 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
6 Six 66
|
|
7 Seven 77
|
|
8 Eight 88
|
|
9 Nine 99
|
|
SELECT * FROM ibport_t6 ORDER BY a;
|
|
a b c
|
|
1 One 11
|
|
2 two 22
|
|
3 three 33
|
|
4 four 44
|
|
5 Five 55
|
|
6 Six 66
|
|
7 Seven 77
|
|
8 Eight 88
|
|
9 Nine 99
|
|
SHOW CREATE TABLE ibport_t1;
|
|
Table Create Table
|
|
ibport_t1 CREATE TABLE `ibport_t1` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW CREATE TABLE ibport_t5;
|
|
Table Create Table
|
|
ibport_t5 CREATE TABLE `ibport_t5` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) /*!50100 TABLESPACE `ibport_s1` */ ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW CREATE TABLE ibport_t6;
|
|
Table Create Table
|
|
ibport_t6 CREATE TABLE `ibport_t6` (
|
|
`a` int(11) DEFAULT NULL,
|
|
`b` varchar(30) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
KEY `ka` (`a`),
|
|
KEY `kb` (`b`)
|
|
) /*!50100 TABLESPACE `ibport_s2` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4
|
|
SELECT s.space_type 'Type', s.name 'Space Name', d.path 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.innodb_sys_datafiles d
|
|
WHERE s.name like '%ibport%' AND s.space = d.space ORDER BY s.space;
|
|
Type Space Name Path
|
|
Single test/ibport_t1 ./test/ibport_t1.ibd
|
|
General ibport_s1 ./ibport_s1_gen.ibd
|
|
General ibport_s2 ../spaces/ibport_s2_gen.ibd
|
|
SELECT s.space_type 'Type', s.name 'Space Name', f.file_name 'Path'
|
|
FROM information_schema.innodb_sys_tablespaces s, information_schema.files f
|
|
WHERE s.name like '%ibport%' AND s.space = f.file_id ORDER BY s.space;
|
|
Type Space Name Path
|
|
Single test/ibport_t1 ./test/ibport_t1.ibd
|
|
General ibport_s1 ./ibport_s1_gen.ibd
|
|
General ibport_s2 ../spaces/ibport_s2_gen.ibd
|
|
#
|
|
# Cleanup
|
|
#
|
|
DROP TABLE ibport_t1;
|
|
DROP TABLE ibport_t5;
|
|
DROP TABLE ibport_t6;
|
|
DROP TABLESPACE ibport_s1;
|
|
DROP TABLESPACE ibport_s2;
|