79 lines
2.5 KiB
Plaintext
79 lines
2.5 KiB
Plaintext
# Embedded server doesn't support restarting.
|
|
--source include/not_embedded.inc
|
|
|
|
# Prepare MYSQLD_DATADIR and MYSQLD_BOOTSTRAP_CMD.
|
|
# Add the datadir to the bootstrap command.
|
|
--let $MYSQLD_DATADIR = `SELECT @@datadir`
|
|
--let $MYSQLD_BOOTSTRAP_CMD = $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --default-tmp-storage-engine=MyISAM
|
|
|
|
###########################################################################
|
|
# 1. Check that --bootstrap reads from stdin
|
|
###########################################################################
|
|
|
|
# Stop server
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql
|
|
USE test;
|
|
CREATE TABLE t1(a INT);
|
|
EOF
|
|
|
|
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
|
|
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql
|
|
|
|
###########################################################################
|
|
# 2. Check that --bootstrap of file with SQL error returns error
|
|
###########################################################################
|
|
|
|
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql
|
|
USE test;
|
|
CREATE TABLE t2;
|
|
EOF
|
|
|
|
--error 1
|
|
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
|
|
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql
|
|
|
|
# Start server
|
|
--source include/start_mysqld.inc
|
|
|
|
# Drop t1 from the previous test (1).
|
|
DROP TABLE t1;
|
|
|
|
# Table t2 should not exists
|
|
--error ER_BAD_TABLE_ERROR
|
|
DROP TABLE t2;
|
|
|
|
###########################################################################
|
|
# 3. Bootstrap with a query larger than 2*thd->net.max_packet
|
|
###########################################################################
|
|
|
|
# Prepare a long query.
|
|
# NOTE: no need to save max_allowed_packet value as the server will be restarted.
|
|
|
|
SET @@global.max_allowed_packet = 100 * @@global.max_allowed_packet;
|
|
|
|
CREATE TABLE t1 SELECT 2 AS a, CONCAT(REPEAT('MySQL', @@max_allowed_packet/10), ';') AS b;
|
|
|
|
--replace_result $MYSQLTEST_VARDIR VARDIR
|
|
--eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/long_query.sql' FROM t1
|
|
|
|
# Stop server
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
--error 1
|
|
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/long_query.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
|
|
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/long_query.sql
|
|
|
|
# Start server
|
|
--source include/start_mysqld.inc
|
|
|
|
SHOW CREATE TABLE t1;
|
|
SELECT a, LENGTH(b) FROM t1;
|
|
|
|
DROP TABLE t1;
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap.log
|