You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

62 lines
1.6 KiB

# Embedded server doesn't support external clients
--source include/not_embedded.inc
# Fast index creation is only available in InnoDB plugin
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo #
--echo # Test the --innodb-optimize-keys option.
--echo #
--let $file=$MYSQLTEST_VARDIR/tmp/t1.sql
# First test that the option has no effect on non-InnoDB tables
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, KEY(b)) ENGINE=MyISAM;
--exec $MYSQL_DUMP --skip-comments --innodb-optimize-keys test t1 >$file
--echo ######################################
--cat_file $file
--echo ######################################
--remove_file $file
DROP TABLE t1;
# Check that for InnoDB tables secondary and foreign keys are created
# after the data is dumped
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 VALUES (0), (1), (2);
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
a INT, b VARCHAR(255), c DECIMAL(10,3),
KEY (b),
UNIQUE KEY uniq(c,a),
FOREIGN KEY (a) REFERENCES t2(a) ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO t1(a,b,c) VALUES (0, "0", 0.0), (1, "1", 1.1), (2, "2", 2.2);
--exec $MYSQL_DUMP --skip-comments --innodb-optimize-keys test t1 t2 >$file
--echo ######################################
--cat_file $file
--echo ######################################
# Check that the resulting dump can be imported back
--exec $MYSQL test < $file
--remove_file $file
DROP TABLE t1, t2;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc