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.
164 lines
5.1 KiB
164 lines
5.1 KiB
--source include/big_test.inc
|
|
|
|
--echo #
|
|
--echo # This file contains bootstrap test cases that do not
|
|
--echo # need to be run with a debug build. See also the
|
|
--echo # test file 'dd_bootstrap_debug.test' for debug
|
|
--echo # test cases.
|
|
--echo #
|
|
|
|
let BASEDIR= `select @@basedir`;
|
|
let DDIR= $MYSQL_TMP_DIR/dd_bootstrap_test;
|
|
let MYSQLD_LOG= $MYSQL_TMP_DIR/server.log;
|
|
let extra_args= --no-defaults --innodb_dedicated_server=OFF --log-error=$MYSQLD_LOG --secure-file-priv="" --loose-skip-auto_generate_certs --loose-skip-sha256_password_auto_generate_rsa_keys --skip-ssl --basedir=$BASEDIR --lc-messages-dir=$MYSQL_SHAREDIR;
|
|
let BOOTSTRAP_SQL= $MYSQL_TMP_DIR/tiny_bootstrap.sql;
|
|
|
|
--echo # Preparation: Shut server down.
|
|
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
--shutdown_server
|
|
--source include/wait_until_disconnected.inc
|
|
|
|
--echo #
|
|
--echo # 1. Try restart after dropping the time_zone_transition_type table.
|
|
--echo # ------------------------------------------------------------------
|
|
|
|
--echo # 1.1 Create bootstrap file.
|
|
write_file $BOOTSTRAP_SQL;
|
|
CREATE SCHEMA test;
|
|
DROP TABLE mysql.time_zone_transition_type;
|
|
EOF
|
|
|
|
--echo # 1.2 First start the server with --initialize, and drop the time_zone_transition_type table.
|
|
--exec $MYSQLD $extra_args --initialize-insecure --datadir=$DDIR --init-file=$BOOTSTRAP_SQL
|
|
|
|
--echo # 1.3 Restart the server against DDIR - should succeed.
|
|
--exec echo "restart: --datadir=$DDIR --no-console --log-error=$MYSQLD_LOG" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
--enable_reconnect
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
--echo # 1.4 Shut server down.
|
|
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
--shutdown_server
|
|
--source include/wait_until_disconnected.inc
|
|
|
|
--echo # 1.5 Look for warning.
|
|
perl;
|
|
use strict;
|
|
my $log= $ENV{'MYSQLD_LOG'} or die;
|
|
open(FILE, "$log") or die;
|
|
my $c_e= grep(/\[Warning\] \[[^]]*\] \[[^]]*\] Can\'t open and lock time zone table/gi,<FILE>);
|
|
print "# Time zone table warning found $c_e times.\n";
|
|
close(FILE);
|
|
EOF
|
|
|
|
--echo # 1.6 Delete bootstrap file, log file and datadir.
|
|
remove_file $BOOTSTRAP_SQL;
|
|
remove_file $MYSQLD_LOG;
|
|
--force-rmdir $DDIR
|
|
|
|
--echo #
|
|
--echo # 2. Try restart after deleting the mysql dd tablespace file.
|
|
--echo # -----------------------------------------------------------
|
|
|
|
--echo # 2.1 First start the server with --initialize.
|
|
--exec $MYSQLD $extra_args --initialize-insecure --datadir=$DDIR
|
|
|
|
--echo # 2.2 Delete the physical tablespace file for mysql.ibd.
|
|
remove_file $DDIR/mysql.ibd;
|
|
|
|
--echo # 2.3 Restart the server against DDIR - should fail.
|
|
--error 1
|
|
--exec $MYSQLD $extra_args --datadir=$DDIR
|
|
|
|
--echo # 2.4 Look for error.
|
|
perl;
|
|
use strict;
|
|
my $log= $ENV{'MYSQLD_LOG'} or die;
|
|
open(FILE, "$log") or die;
|
|
my $c_e= grep(/Failed to find valid data directory./gi,<FILE>);
|
|
print "# DD initialization error found $c_e times.\n";
|
|
close(FILE);
|
|
EOF
|
|
|
|
--echo # 2.5 Delete log file and datadir.
|
|
remove_file $MYSQLD_LOG;
|
|
--force-rmdir $DDIR
|
|
|
|
--echo #
|
|
--echo # 3. Try restart on a non-existing datadir.
|
|
--echo # -----------------------------------------
|
|
|
|
--echo # 3.1 Restart the server against non-existing DDIR - should fail.
|
|
# Note that the error happens before log-error is setup, so we must redirect
|
|
# stderr to get log messages for analysis below.
|
|
--error 1
|
|
--exec $MYSQLD $extra_args --datadir=$DDIR > $MYSQLD_LOG 2>&1
|
|
|
|
--echo # 3.2 Look for error.
|
|
perl;
|
|
use strict;
|
|
my $log= $ENV{'MYSQLD_LOG'} or die;
|
|
open(FILE, "$log") or die;
|
|
my $c_e= grep(/\[ERROR\] \[[^]]*\] \[[^]]*\] failed to set datadir/gi,<FILE>);
|
|
print "# Datadir error found $c_e times.\n";
|
|
close(FILE);
|
|
EOF
|
|
|
|
--echo # 3.3 Delete log file but datadir does not need cleanup
|
|
--echo # since it is non-existent.
|
|
remove_file $MYSQLD_LOG;
|
|
|
|
--echo #
|
|
--echo # 4. Try restart on an empty datadir (non-existing mysql dir).
|
|
--echo # ------------------------------------------------------------
|
|
|
|
--mkdir $DDIR
|
|
|
|
--echo # 4.1 Restart the server against existing but empty DDIR - should fail.
|
|
--error 1
|
|
--exec $MYSQLD $extra_args --datadir=$DDIR
|
|
|
|
--echo # 4.2 Look for error.
|
|
perl;
|
|
use strict;
|
|
my $log= $ENV{'MYSQLD_LOG'} or die;
|
|
open(FILE, "$log") or die;
|
|
my $c_e= grep(/Failed to find valid data directory/gi,<FILE>);
|
|
print "# DD initialization error found $c_e times.\n";
|
|
close(FILE);
|
|
EOF
|
|
|
|
--echo # 4.3 Delete log file and datadir.
|
|
remove_file $MYSQLD_LOG;
|
|
--force-rmdir $DDIR
|
|
|
|
--echo #
|
|
--echo # 5. Try restart on an empty mysql dir.
|
|
--echo # -------------------------------------
|
|
|
|
--mkdir $DDIR
|
|
--mkdir $DDIR/mysql
|
|
|
|
--echo # 5.1 Restart the server against existing but empty mysql dir - should fail.
|
|
--error 1
|
|
--exec $MYSQLD $extra_args --datadir=$DDIR
|
|
|
|
--echo # 5.2 Look for error.
|
|
perl;
|
|
use strict;
|
|
my $log= $ENV{'MYSQLD_LOG'} or die;
|
|
open(FILE, "$log") or die;
|
|
my $c_e= grep(/Failed to find valid data directory/gi,<FILE>);
|
|
print "# DD initialization error found $c_e times.\n";
|
|
close(FILE);
|
|
EOF
|
|
|
|
--echo # 5.3 Delete log file and datadir.
|
|
remove_file $MYSQLD_LOG;
|
|
--force-rmdir $DDIR
|
|
|
|
--echo #
|
|
--echo # Cleanup: Restarting the server against default datadir.
|
|
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
--enable_reconnect
|
|
--source include/wait_until_connected_again.inc
|
|
|