#Check whether unzip is installed on the system
#Store the command output into a temp file.
#Get the value of the  variable from perl, to MTR
#Check the status is non-zero
#Remove the temp file tar.inc
# Set the environmental variables
# Stop server
# Copy the remote tablespace & DB zip files from suite location to working location.
# Check that the file exists in the working folder.
# Unzip the zip file.
# Remove the DOS based *.isl files from the MySql Data directory.
# Check that the *.ibd files are in the required location.
# Create new *.isl files with the correct path to the *.ibd files,
#change path separator Linux / format to windows  format by Perl script,
#in the *.ISL files , in the Mysql data directory
emp2#p#p1.isl
emp2#p#p2.isl
emp3.isl
emp4#p#p1.isl
emp4#p#p2.isl
purchase#p#p0#sp#s0.isl
purchase#p#p0#sp#s1.isl
purchase#p#p1#sp#s2.isl
purchase#p#p1#sp#s3.isl
# Restarting the server with skip-grant-tables option and updating
# mysql.user table. This is to deal with the restriction imposed on
# plugin field for users in WL6982.
# Restart the DB server from unzip location of MySQL Data Dir 
# Stop server
# Restart the DB server from unzip location of MySQL Data Dir 
# Check the DB & tables with DML statements.
use test;
SHOW CREATE TABLE emp1;
Table	Create Table
emp1	CREATE TABLE `emp1` (
  `empno` int(11) DEFAULT NULL,
  `ename` varchar(30) DEFAULT NULL,
  `sal` decimal(3,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE emp2;
Table	Create Table
emp2	CREATE TABLE `emp2` (
  `empno` int(11) DEFAULT NULL,
  `ename` varchar(30) DEFAULT NULL,
  `sal` decimal(3,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (empno)
(PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/tab1' ENGINE = InnoDB,
 PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/tab2' ENGINE = InnoDB) */
SHOW CREATE TABLE emp3;
Table	Create Table
emp3	CREATE TABLE `emp3` (
  `empno` int(11) DEFAULT NULL,
  `ename` varchar(30) DEFAULT NULL,
  `sal` decimal(3,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/mysqld.5980/tab3/'
SHOW CREATE TABLE emp4;
Table	Create Table
emp4	CREATE TABLE `emp4` (
  `empno` int(11) DEFAULT NULL,
  `ename` varchar(30) DEFAULT NULL,
  `sal` decimal(3,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
/*!50100 PARTITION BY HASH (empno)
(PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/tab4' ENGINE = InnoDB,
 PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/tab5' ENGINE = InnoDB) */
SHOW CREATE TABLE purchase;
Table	Create Table
purchase	CREATE TABLE `purchase` (
  `id` int(11) DEFAULT NULL,
  `purchased` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( YEAR(purchased))
SUBPARTITION BY HASH ( TO_DAYS(purchased))
(PARTITION p0 VALUES LESS THAN (1990)
 (SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/part0' ENGINE = InnoDB,
  SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/part1' ENGINE = InnoDB),
 PARTITION p1 VALUES LESS THAN (2000)
 (SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/part2' ENGINE = InnoDB,
  SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/part3' ENGINE = InnoDB)) */
SELECT COUNT(*) FROM emp1;
COUNT(*)
2
SELECT COUNT(*) FROM emp2;
COUNT(*)
2
SELECT COUNT(*) FROM emp3;
COUNT(*)
2
SELECT COUNT(*) FROM emp4;
COUNT(*)
2
SELECT COUNT(*) FROM purchase;
COUNT(*)
1
DELETE  FROM emp1;
DELETE  FROM emp2;
DELETE  FROM emp3;
DELETE  FROM emp4;
DELETE FROM purchase;
SELECT COUNT(*) FROM emp1;
COUNT(*)
0
SELECT COUNT(*) FROM emp2;
COUNT(*)
0
SELECT COUNT(*) FROM emp3;
COUNT(*)
0
SELECT COUNT(*) FROM emp4;
COUNT(*)
0
SELECT COUNT(*) FROM purchase;
COUNT(*)
0
# Check the system tables have the proper entry of the tables.
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
./test/emp1.ibd
MYSQL_TMP_DIR/mysqld.5980/tab1/test/emp2#p#p1.ibd
MYSQL_TMP_DIR/mysqld.5980/tab2/test/emp2#p#p2.ibd
MYSQL_TMP_DIR/mysqld.5980/tab3/test/emp3.ibd
MYSQL_TMP_DIR/mysqld.5980/part0/test/purchase#p#p0#sp#s0.ibd
MYSQL_TMP_DIR/mysqld.5980/part1/test/purchase#p#p0#sp#s1.ibd
MYSQL_TMP_DIR/mysqld.5980/part2/test/purchase#p#p1#sp#s2.ibd
MYSQL_TMP_DIR/mysqld.5980/part3/test/purchase#p#p1#sp#s3.ibd
MYSQL_TMP_DIR/mysqld.5980/tab4/test/emp4#p#p1.ibd
MYSQL_TMP_DIR/mysqld.5980/tab5/test/emp4#p#p2.ibd
SELECT name,file_format,row_format 
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
name	file_format	row_format
test/emp1	Antelope	Compact or Redundant
test/emp2#P#p1	Antelope	Compact or Redundant
test/emp2#P#p2	Antelope	Compact or Redundant
test/emp3	Antelope	Compact or Redundant
test/emp4#P#p1	Barracuda	Dynamic
test/emp4#P#p2	Barracuda	Dynamic
test/purchase#P#p0#SP#s0	Antelope	Compact or Redundant
test/purchase#P#p0#SP#s1	Antelope	Compact or Redundant
test/purchase#P#p1#SP#s2	Antelope	Compact or Redundant
test/purchase#P#p1#SP#s3	Antelope	Compact or Redundant
SELECT name,n_cols,file_format,row_format 
FROM information_schema.innodb_sys_tables 
WHERE name LIKE '%emp%' ORDER BY name;
name	n_cols	file_format	row_format
test/emp1	6	Antelope	Compact
test/emp2#P#p1	6	Antelope	Compact
test/emp2#P#p2	6	Antelope	Compact
test/emp3	6	Antelope	Compact
test/emp4#P#p1	6	Barracuda	Dynamic
test/emp4#P#p2	6	Barracuda	Dynamic
SELECT name,n_cols,file_format,row_format 
FROM information_schema.innodb_sys_tables 
WHERE name LIKE '%purchase%' ORDER BY name;
name	n_cols	file_format	row_format
test/purchase#P#p0#SP#s0	5	Antelope	Compact
test/purchase#P#p0#SP#s1	5	Antelope	Compact
test/purchase#P#p1#SP#s2	5	Antelope	Compact
test/purchase#P#p1#SP#s3	5	Antelope	Compact
#
# Cleanup
#
DROP TABLE emp1;
DROP TABLE emp2;
DROP TABLE emp3;
DROP TABLE emp4;
DROP TABLE purchase;
CREATE DATABASE mtr;
CREATE PROCEDURE mtr.check_warnings(OUT result INT)
BEGIN
SELECT 0 INTO RESULT;
END|
