# This test upgrades tables from 5.7 to 8.0.x where
# datafiles are not known directories.
# a warning message will be put into the error log
# Stop the running the server
######################################################################
# Unzip a 5.7 datadir with tables where datafiles are at
# unknown directories
# start the server using this directory
######################################################################
######################################################################
# Copy and unzip the datadir.
######################################################################
# Restart the server against the unzipped datadir
# restart: --datadir=DATADIR --innodb-page-size=16k
# Verify tables after upgrade
USE test;
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `id` int NOT NULL,
  `fname` varchar(30) DEFAULT NULL,
  `lname` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='../unknown/'
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `c1` int NOT NULL,
  PRIMARY KEY (`c1`)
) /*!50100 TABLESPACE `ts2` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
SHOW CREATE TABLE t3;
Table	Create Table
t3	CREATE TABLE `t3` (
  `id` int 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 = '../unknown' ENGINE = InnoDB,
  SUBPARTITION s1 DATA DIRECTORY = '../unknown' ENGINE = InnoDB),
 PARTITION p1 VALUES LESS THAN (2000)
 (SUBPARTITION s2 DATA DIRECTORY = '../unknown' ENGINE = InnoDB,
  SUBPARTITION s3 DATA DIRECTORY = '../unknown' ENGINE = InnoDB),
 PARTITION p2 VALUES LESS THAN MAXVALUE
 (SUBPARTITION s4 DATA DIRECTORY = '../unknown' ENGINE = InnoDB,
  SUBPARTITION s5 DATA DIRECTORY = '../unknown' ENGINE = InnoDB)) */
SELECT * FROM t1;
id	fname	lname
1669	Jim	Smith
337	Mary	Jones
16	Frank	White
2005	Linda	Black
SELECT * FROM t2;
c1
16
337
1669
2005
SELECT * FROM t3;
id	purchased
4	1970-05-31
1	1980-05-31
5	1985-05-31
2	2090-05-31
3	2012-05-31
6	2006-05-31
# Run some DML statements
INSERT INTO t1 VALUES (207, "Tom", "Kim");
DELETE FROM t2 WHERE c1=337;
UPDATE t3 SET purchased='2001-01-31' WHERE id=6;
# Verify results
SELECT * FROM t1;
id	fname	lname
1669	Jim	Smith
337	Mary	Jones
16	Frank	White
2005	Linda	Black
207	Tom	Kim
SELECT * FROM t2;
c1
16
1669
2005
SELECT * FROM t3;
id	purchased
4	1970-05-31
1	1980-05-31
5	1985-05-31
2	2090-05-31
3	2012-05-31
6	2001-01-31
# Cleanup
# Shutdown server
# Remove copied files
# Resart the server
# restart
