mariadb/mysql-test/main/bootstrap.test
2024-10-03 10:55:08 +03:00

168 lines
5.6 KiB
Text

--echo #
--echo # test mysqld in bootstrap mode
--echo #
--source include/not_embedded.inc
--source include/have_example_plugin.inc
--let test_bootstrap=$MYSQLTEST_VARDIR/tmp/test_bootstrap.sql
--write_file $test_bootstrap
use test;
EOF
# Add the datadir to the bootstrap command
let $MYSQLD_DATADIR= `select @@datadir`;
let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --tmpdir=$MYSQL_TMP_DIR --default-storage-engine=MyISAM --loose-skip-innodb --plugin-maturity=unknown;
--echo #
--echo # Check that --bootstrap reads from stdin
--echo #
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql
use test;
CREATE TABLE t1(a int);
EOF
--source include/kill_mysqld.inc
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--source include/start_mysqld.inc
drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
--echo #
--echo # Check that --bootstrap of file with SQL error returns error
--echo #
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql
use test;
CREATE TABLE t1;
EOF
--source include/kill_mysqld.inc
--error 1
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
# Table t1 should not exists
--source include/start_mysqld.inc
--error 1051
drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql;
--echo #
--echo # Bootstrap with a large thd->net.max_packet
--echo #
--disable_query_log
create table t1 select 2 as a, concat(repeat('MySQL', @@max_allowed_packet/10), ';') as b;
--disable_cursor_protocol
--disable_ps2_protocol
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/long_query.sql' from t1;
--enable_ps2_protocol
--enable_cursor_protocol
--enable_query_log
--source include/kill_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;
--source include/start_mysqld.inc
drop table t1;
--echo #
--echo # End of 5.1 tests
--echo #
--echo #
--echo # Bug #11766306: 59393: HAVE_INNODB=YES WHEN MYSQLD
--echo # STARTED WITH --SKIP-INNODB
--echo #
# need the --skip-innodb option present for the test to succeed
SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
and SUPPORT='YES';
--source include/kill_mysqld.inc
--echo #
--echo # MDEV-13063 Server crashes in intern_plugin_lock or assertion `plugin_ptr->ref_count == 1' fails in plugin_init
--echo #
--error 1
--exec $MYSQLD_BOOTSTRAP_CMD --myisam_recover_options=NONE 2>/dev/null
--echo #
--echo # MDEV-19349 mysql_install_db: segfault at tmp_file_prefix check
--echo #
--exec $MYSQLD_BOOTSTRAP_CMD < $test_bootstrap >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--source include/start_mysqld.inc
--echo #
--echo # End of 5.5 tests
--echo #
--echo #
--echo # Check that --bootstrap can install and uninstall plugins
--echo #
let $PLUGIN_DIR=`select @@plugin_dir`;
--source include/kill_mysqld.inc
--write_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql
install soname 'ha_example';
uninstall plugin unusable;
EOF
--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/install_plugin.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql
--echo #
--echo # Check that installed plugins are *not* automatically loaded in --bootstrap
--echo #
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql
SET SQL_MODE="";
use test;
create table t1(a int) engine=example charset=latin1;
EOF
--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql
--source include/start_mysqld.inc
flush tables;
show create table t1;
drop table t1;
--replace_result .dll .so
select * from mysql.plugin;
truncate table mysql.plugin;
--source include/kill_mysqld.inc
--echo #
--echo # MDEV-9969 mysql_install_db error processing ignore_db_dirs.
--echo #
--exec $MYSQLD_BOOTSTRAP_CMD --ignore-db-dirs='some_dir' --ignore-db-dirs='some_dir' < $test_bootstrap >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--echo #
--echo # MDEV-13397 MariaDB upgrade fail when using default_time_zone
--echo #
--exec $MYSQLD_BOOTSTRAP_CMD --default-time-zone=Europe/Moscow < $test_bootstrap >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--echo #
--echo # MDEV-30818 invalid ssl prevents bootstrap
--echo #
--exec $MYSQLD_BOOTSTRAP_CMD --ssl-ca=/dev/nonexistent < $test_bootstrap >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--echo #
--echo # End of 10.3 tests
--echo #
--echo #
--echo # MDEV-28782 mariadb-tzinfo-to-sql to work in bootstrap mode
--echo #
--write_file $MYSQLTEST_VARDIR/tmp/tz.sql
use test;
create table time_zone like mysql.time_zone;
create table time_zone_leap_second like mysql.time_zone_leap_second;
create table time_zone_name like mysql.time_zone_name;
create table time_zone_transition like mysql.time_zone_transition;
create table time_zone_transition_type like mysql.time_zone_transition_type;
EOF
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog std_data/zoneinfo/GMT GMT 2>/dev/null >> $MYSQLTEST_VARDIR/tmp/tz.sql
--append_file $MYSQLTEST_VARDIR/tmp/tz.sql
DROP TABLE time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type;
EOF
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/tz.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/tz.sql
--echo #
--echo # End of 10.6 tests
--echo #
# restore
--source include/start_mysqld.inc
--remove_file $test_bootstrap