diff options
Diffstat (limited to '')
28 files changed, 421 insertions, 141 deletions
diff --git a/mysql-test/include/aria_log_control_load.inc b/mysql-test/include/aria_log_control_load.inc new file mode 100644 index 00000000..34db3aeb --- /dev/null +++ b/mysql-test/include/aria_log_control_load.inc @@ -0,0 +1,11 @@ +# +# This file loads aria_log_control file into a user variable @aria_log_control. +# Set $ARIA_DATADIR before including this file +# + +--disable_query_log +--copy_file $ARIA_DATADIR/aria_log_control $MYSQLTEST_VARDIR/aria_log_control_tmp +--chmod 0777 $MYSQLTEST_VARDIR/aria_log_control_tmp +--eval SET @aria_log_control=(SELECT LOAD_FILE('$MYSQLTEST_VARDIR/aria_log_control_tmp')) +--remove_file $MYSQLTEST_VARDIR/aria_log_control_tmp +--enable_query_log diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test index 078f6572..b43dffbf 100644 --- a/mysql-test/include/check-testcase.test +++ b/mysql-test/include/check-testcase.test @@ -32,7 +32,6 @@ if ($tmp) --echo Relay_Master_Log_File # --echo Slave_IO_Running No --echo Slave_SQL_Running No - --echo Replicate_Rewrite_DB # --echo Replicate_Do_DB # --echo Replicate_Ignore_DB # --echo Replicate_Do_Table # @@ -74,13 +73,22 @@ if ($tmp) --echo Slave_DDL_Groups # --echo Slave_Non_Transactional_Groups # --echo Slave_Transactional_Groups # + --echo Replicate_Rewrite_DB # } if (!$tmp) { # Note: after WL#5177, fields 13-18 shall not be filtered-out. - --replace_column 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # 23 # 24 # 25 # 26 # 27 # 41 # 42 # 43 # 45 # 52 # 53 # 54 # + --replace_column 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 22 # 23 # 24 # 25 # 26 # 40 # 41 # 42 # 44 # 51 # 52 # 53 # 54 # query_vertical SHOW SLAVE STATUS; } +# +# Note, we must never, _ever_, add extra rows to this output of SHOW SLAVE +# STATUS, except at the very end, as this breaks backwards compatibility +# with applications or scripts that parse the output. This also means that +# we cannot add _any_ new rows in a GA version if a different row was +# already added in a later MariaDB version, as this would make it impossible +# to merge the change up while preserving the order of rows. +# # # Ensure that we don't get warnings from mysql.proc (used by check_mysqld) diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index c696613d..132fdcff 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -613,13 +613,17 @@ call p_verify_status_increment(2, 0, 2, 0); drop table t2; set sql_mode=no_engine_substitution; create temporary table t2 (a int); -call p_verify_status_increment(1, 0, 0, 0); +# One commit for the create temporary table, and two for committing the +# read of the stored procedure from Aria table (creating temporary table +# clears the sp cache). +call p_verify_status_increment(3, 0, 2, 0); set sql_mode=default; --echo # 19. A function changes temp-trans-table. --echo # select f1(); ---echo # Two commits because a binary log record is written -call p_verify_status_increment(2, 0, 1, 0); +--echo # Two commits because a binary log record is written, and another two +--echo # as the function f1() is reloaded after creating temporary table. +call p_verify_status_increment(4, 0, 3, 0); commit; call p_verify_status_increment(2, 0, 1, 0); @@ -672,9 +676,11 @@ call p_verify_status_increment(2, 0, 1, 0); --echo # 25. DDL: DROP TEMPORARY TABLE, does not start a transaction --echo # drop temporary table t2; -call p_verify_status_increment(1, 0, 1, 0); +# Dropping temporary table clears SP caches, so get another two commit +# increments from loading the p_verify_status_increment procedure. +call p_verify_status_increment(3, 0, 2, 0); commit; -call p_verify_status_increment(1, 0, 1, 0); +call p_verify_status_increment(1, 0, 0, 0); --echo # 26. Verify that SET AUTOCOMMIT issues an implicit commit --echo # @@ -721,7 +727,9 @@ call p_verify_status_increment(1, 0, 1, 0); create table t2 (a int); call p_verify_status_increment(0, 0, 0, 0); do (select f1() from t1 where a=2); -call p_verify_status_increment(2, 2, 2, 2); +# Again extra 2 commit increments from re-loading function f1 after +# dropping temporary table. +call p_verify_status_increment(4, 2, 4, 2); commit; call p_verify_status_increment(2, 2, 2, 2); diff --git a/mysql-test/include/crash_mysqld.inc b/mysql-test/include/crash_mysqld.inc index 4190d24d..89bc8ced 100644 --- a/mysql-test/include/crash_mysqld.inc +++ b/mysql-test/include/crash_mysqld.inc @@ -4,7 +4,7 @@ --source include/not_embedded.inc # Write file to make mysql-test-run.pl expect crash and restart ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # Setup the mysqld to crash at shutdown SET debug_dbug="d,crash_shutdown"; diff --git a/mysql-test/include/deadlock.inc b/mysql-test/include/deadlock.inc index abf217ae..362d456e 100644 --- a/mysql-test/include/deadlock.inc +++ b/mysql-test/include/deadlock.inc @@ -103,7 +103,6 @@ connection con2; # The following query should hang because con1 is locking the record update t2 set a=2 where b = 0; -select * from t2; --send update t1 set x=2 where id = 0; --sleep 2 diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 89d0d779..06a4ff15 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -71,7 +71,7 @@ loose-performance-schema-hosts-size=100 loose-performance-schema-users-size=100 loose-performance-schema-max-mutex-instances=5000 loose-performance-schema-max-rwlock-instances=5000 -loose-performance-schema-max-cond-instances=1000 +loose-performance-schema-max-cond-instances=1500 loose-performance-schema-max-file-instances=10000 loose-performance-schema-max-socket-instances=1000 loose-performance-schema-max-table-instances=500 @@ -91,7 +91,7 @@ loose-performance-schema-events-statements-history-size=10 loose-performance-schema-events-statements-history-long-size=1000 loose-performance-schema-events-transactions-history-size=10 loose-performance-schema-events-transactions-history-long-size=1000 -loose-performance-schema-max-thread-instances=200 +loose-performance-schema-max-thread-instances=400 loose-performance-schema-session-connect-attrs-size=2048 loose-performance-schema-max-metadata-locks=10000 diff --git a/mysql-test/include/expect_crash.inc b/mysql-test/include/expect_crash.inc index b4bd9828..56abc88a 100644 --- a/mysql-test/include/expect_crash.inc +++ b/mysql-test/include/expect_crash.inc @@ -2,4 +2,4 @@ --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect # There should be a debug crash after using this .inc file ---exec echo "wait" > $_expect_file_name +--write_line wait $_expect_file_name diff --git a/mysql-test/include/have_innodb.combinations b/mysql-test/include/have_innodb.combinations deleted file mode 100644 index f1131c44..00000000 --- a/mysql-test/include/have_innodb.combinations +++ /dev/null @@ -1,39 +0,0 @@ -[innodb_plugin] -ignore-builtin-innodb -plugin-load-add=$HA_INNODB_SO -innodb -innodb-cmpmem -innodb-cmp-per-index -innodb-trx -innodb-locks -innodb-lock-waits -innodb-buffer-pool-stats -innodb-buffer-page -innodb-buffer-page-lru -innodb-sys-columns -innodb-sys-fields -innodb-sys-foreign -innodb-sys-foreign-cols -innodb-sys-indexes -innodb-sys-tables -innodb-sys-virtual -innodb-metrics - -[innodb] -innodb -innodb-cmpmem -innodb-cmp-per-index -innodb-trx -innodb-locks -innodb-lock-waits -innodb-metrics -innodb-buffer-pool-stats -innodb-buffer-page -innodb-buffer-page-lru -innodb-sys-columns -innodb-sys-fields -innodb-sys-foreign -innodb-sys-foreign-cols -innodb-sys-indexes -innodb-sys-tables -innodb-sys-virtual diff --git a/mysql-test/include/have_innodb.inc b/mysql-test/include/have_innodb.inc index 8c9cdb54..1e853d18 100644 --- a/mysql-test/include/have_innodb.inc +++ b/mysql-test/include/have_innodb.inc @@ -3,6 +3,11 @@ # will be skipped unless innodb is enabled # --disable_query_log +if (`select version() like '%debug%'`) +{ +SET STATEMENT sql_log_bin=0 FOR +call mtr.add_suppression("InnoDB: Trying to delete tablespace.*pending operations"); +} if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like 'MSAN%'`) { SET STATEMENT sql_log_bin=0 FOR diff --git a/mysql-test/include/have_innodb.opt b/mysql-test/include/have_innodb.opt new file mode 100644 index 00000000..0a6d4d9c --- /dev/null +++ b/mysql-test/include/have_innodb.opt @@ -0,0 +1,17 @@ +--innodb +--innodb-cmpmem +--innodb-cmp-per-index +--innodb-trx +--innodb-locks +--innodb-lock-waits +--innodb-metrics +--innodb-buffer-pool-stats +--innodb-buffer-page +--innodb-buffer-page-lru +--innodb-sys-columns +--innodb-sys-fields +--innodb-sys-foreign +--innodb-sys-foreign-cols +--innodb-sys-indexes +--innodb-sys-tables +--innodb-sys-virtual diff --git a/mysql-test/include/innodb_rollback_on_timeout.inc b/mysql-test/include/innodb_rollback_on_timeout.inc index 274bbe12..d41e1f1e 100644 --- a/mysql-test/include/innodb_rollback_on_timeout.inc +++ b/mysql-test/include/innodb_rollback_on_timeout.inc @@ -1,4 +1,3 @@ ---source include/have_innodb.inc # # Bug #24200: Provide backwards compatibility mode for 4.x "rollback on # transaction timeout" @@ -22,7 +21,6 @@ select * from t1; connection con1; begin work; insert into t1 values (5); -select * from t1; # Lock wait timeout set to 2 seconds in <THIS TEST>-master.opt; this # statement will time out; in 5.0.13+, it will not roll back transaction. --error ER_LOCK_WAIT_TIMEOUT diff --git a/mysql-test/include/kill_and_restart_mysqld.inc b/mysql-test/include/kill_and_restart_mysqld.inc index b67fb735..50b28bcd 100644 --- a/mysql-test/include/kill_and_restart_mysqld.inc +++ b/mysql-test/include/kill_and_restart_mysqld.inc @@ -7,7 +7,7 @@ if (!$restart_parameters) --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect --echo # Kill and $restart_parameters ---exec echo "$restart_parameters" > $_expect_file_name +--write_line "$restart_parameters" $_expect_file_name --shutdown_server 0 --source include/wait_until_disconnected.inc --enable_reconnect diff --git a/mysql-test/include/kill_galera.inc b/mysql-test/include/kill_galera.inc index aba672d8..887e21f5 100644 --- a/mysql-test/include/kill_galera.inc +++ b/mysql-test/include/kill_galera.inc @@ -3,7 +3,7 @@ # Write file to make mysql-test-run.pl expect the crash, but don't start it --let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect ---exec echo "wait" > $_expect_file_name +--write_line wait $_expect_file_name # Kill the connected server --disable_reconnect diff --git a/mysql-test/include/kill_mysqld.inc b/mysql-test/include/kill_mysqld.inc index 01ee7f82..a41af2d7 100644 --- a/mysql-test/include/kill_mysqld.inc +++ b/mysql-test/include/kill_mysqld.inc @@ -2,6 +2,6 @@ --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --echo # Kill the server ---exec echo "wait" > $_expect_file_name +--write_line wait $_expect_file_name --shutdown_server 0 --source include/wait_until_disconnected.inc diff --git a/mysql-test/include/rpl_change_topology.inc b/mysql-test/include/rpl_change_topology.inc index b63700b0..ddaf90a9 100644 --- a/mysql-test/include/rpl_change_topology.inc +++ b/mysql-test/include/rpl_change_topology.inc @@ -96,10 +96,11 @@ # Remove whitespace from $rpl_topology --let $rpl_topology= `SELECT REPLACE('$rpl_topology', ' ', '')` +--source include/slow_environ.inc + --let $include_filename= rpl_change_topology.inc [new topology=$rpl_topology] --source include/begin_include_file.inc - if ($rpl_debug) { --echo ---- Check input ---- @@ -235,11 +236,11 @@ if (!$rpl_skip_change_master) } if ($rpl_master_log_file) { - eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_LOG_FILE = '$_rpl_master_log_file'$_rpl_master_log_pos, MASTER_CONNECT_RETRY = 1, MASTER_USE_GTID=NO; + eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_LOG_FILE = '$_rpl_master_log_file'$_rpl_master_log_pos, MASTER_CONNECT_RETRY = 1$_timeout_adjustment, MASTER_USE_GTID=NO; } if (!$rpl_master_log_file) { - eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_CONNECT_RETRY=1; + eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_CONNECT_RETRY=1$_timeout_adjustment; } } if ($_rpl_master == '') diff --git a/mysql-test/include/rpl_clone_slave_using_mariadb-backup.inc b/mysql-test/include/rpl_clone_slave_using_mariadb-backup.inc new file mode 100644 index 00000000..96fcfa21 --- /dev/null +++ b/mysql-test/include/rpl_clone_slave_using_mariadb-backup.inc @@ -0,0 +1,297 @@ +if ($cnf == "galera2_to_mariadb") +{ + --let MASTER_MYPORT= $NODE_MYPORT_1 + --connect master, 127.0.0.1, root, , test, $NODE_MYPORT_1 + --connect slave, 127.0.0.1, root, , test, $NODE_MYPORT_3 + --disable_query_log + --replace_result $MASTER_MYPORT ### + --eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$MASTER_MYPORT, MASTER_USE_GTID=NO; + --enable_query_log + START SLAVE; + --source include/wait_for_slave_to_start.inc + + --let XTRABACKUP_BACKUP_OPTIONS=--no-defaults --user=root --host='127.0.0.1' --port=$NODE_MYPORT_3 + --let XTRABACKUP_COPY_BACK_OPTIONS= --no-defaults +} + +if ($cnf == "mariadb_to_mariadb") +{ + --let XTRABACKUP_BACKUP_OPTIONS=--defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 + --let XTRABACKUP_COPY_BACK_OPTIONS=--defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 +} + +--connection master +--let $MYSQLD_DATADIR_MASTER= `select @@datadir` +--connection slave +--let $MYSQLD_DATADIR_SLAVE= `select @@datadir` + +# This test covers the filename:pos based synchronization +# between the master and the slave. +# If we ever need to test a GTID based synchronization, +# it should be done in a separate test. + + +--echo ############################################################## +--echo ### Initial block with some transactions + +--echo ### Slave: Make sure replication is not using GTID +--connection slave +--let $value= query_get_value(SHOW SLAVE STATUS, "Using_Gtid", 1) +--echo # Using_Gtid=$value + +--echo ### Master: Create and populate t1 +--connection master +CREATE TABLE t1(a TEXT) ENGINE=InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES ('tr#00:stmt#00 - slave run#0, before backup'); +INSERT INTO t1 VALUES ('tr#00:stmt#01 - slave run#0, before backup'); +INSERT INTO t1 VALUES ('tr#00:stmt#02 - slave run#0, before backup'); +COMMIT; +--sync_slave_with_master + + + +--echo ############################################################## +--echo ### Run the last transaction before mariadb-backup --backup +--echo ### Remember SHOW MASTER STATUS and @@gtid_binlog_pos +--echo ### before and after the transaction. + +--echo ### Master: Rember MASTER STATUS and @@gtid_binlog_pos before tr#01 +--connection master +--let $master_before_tr01_show_master_status_file=query_get_value(SHOW MASTER STATUS, File, 1) +--let $master_before_tr01_show_master_status_position=query_get_value(SHOW MASTER STATUS, Position, 1) +--let $master_before_tr01_gtid_binlog_pos=`SELECT @@global.gtid_binlog_pos` + +--echo ### Slave: Remember MASTER STATUS and @@gtid_binlog_pos before tr#01 +--connection slave +--let $slave_before_tr01_show_master_status_file=query_get_value(SHOW MASTER STATUS, File, 1) +--let $slave_before_tr01_show_master_status_position=query_get_value(SHOW MASTER STATUS, Position, 1) +--let $slave_before_tr01_gtid_binlog_pos=`SELECT @@global.gtid_binlog_pos` + +--echo ### Master: Run the actual last transaction before the backup +--connection master +START TRANSACTION; +INSERT INTO t1 VALUES ('tr#01:stmt#00 - slave run#0, before backup'); +INSERT INTO t1 VALUES ('tr#01:stmt#01 - slave run#0, before backup'); +INSERT INTO t1 VALUES ('tr#01:stmt#02 - slave run#0, before backup'); +COMMIT; +--sync_slave_with_master + +--echo ### Master: Remember MASTER STATUS and @@gtid_binlog_pos after tr#01 +--connection master +--let $master_after_tr01_show_master_status_file=query_get_value(SHOW MASTER STATUS, File, 1) +--let $master_after_tr01_show_master_status_position=query_get_value(SHOW MASTER STATUS, Position, 1) +--let $master_after_tr01_gtid_binlog_pos=`SELECT @@global.gtid_binlog_pos` + +--echo ### Slave: Remember MASTER STATUS and @@gtid_binlog_pos after tr#01 +--connection slave +--let $slave_after_tr01_show_master_status_file=query_get_value(SHOW MASTER STATUS, File, 1) +--let $slave_after_tr01_show_master_status_position=query_get_value(SHOW MASTER STATUS, Position, 1) +--let $slave_after_tr01_gtid_binlog_pos=`SELECT @@global.gtid_binlog_pos` + + +--echo ############################################################## +--echo ### Running `mariadb-backup --backup,--prepare` and checking +--echo ### that xtrabackup_slave_info and xtrabackup_binlog_info are OK + +--echo ### Slave: Create a backup +--let $backup_slave=$MYSQLTEST_VARDIR/tmp/backup-slave +--disable_result_log +--exec $XTRABACKUP $XTRABACKUP_BACKUP_OPTIONS --slave-info --backup --target-dir=$backup_slave +--enable_result_log + +--echo ### Slave: Prepare the backup +--exec $XTRABACKUP --prepare --target-dir=$backup_slave + +--echo ### Slave: xtrabackup files: +--echo ############################ xtrabackup_slave_info +--replace_result $master_after_tr01_show_master_status_file master_after_tr01_show_master_status_file $master_after_tr01_show_master_status_position master_after_tr01_show_master_status_position +--cat_file $backup_slave/xtrabackup_slave_info +--echo ############################ xtrabackup_binlog_info +--replace_result $slave_after_tr01_show_master_status_file slave_after_tr01_show_master_status_file $slave_after_tr01_show_master_status_position slave_after_tr01_show_master_status_position $slave_after_tr01_gtid_binlog_pos slave_after_tr01_gtid_binlog_pos +--cat_file $backup_slave/xtrabackup_binlog_info +--echo ############################ + + +--echo ############################################################## +--echo ### Run more transactions after the backup: +--echo ### - while the slave is still running, then +--echo ### - while the slave is shut down + +--echo ### Master: Run another transaction while the slave is still running +--connection master +START TRANSACTION; +INSERT INTO t1 VALUES ('tr#02:stmt#00 - slave run#0, after backup'); +INSERT INTO t1 VALUES ('tr#02:stmt#01 - slave run#0, after backup'); +INSERT INTO t1 VALUES ('tr#02:stmt@02 - slave run#0, after backup'); +COMMIT; +--sync_slave_with_master + +--echo ### Master: Remember MASTER STATUS and @@gtid_binlog_pos after tr#02 +--connection master +--let $master_after_tr02_show_master_status_file=query_get_value(SHOW MASTER STATUS, File, 1) +--let $master_after_tr02_show_master_status_position=query_get_value(SHOW MASTER STATUS, Position, 1) +--let $master_after_tr02_gtid_binlog_pos=`SELECT @@global.gtid_binlog_pos` + +--echo ### Slave: Remember MASTER STATUS and @@gtid_binlog_pos after tr#02 +--connection slave +--let $slave_after_tr02_show_master_status_file=query_get_value(SHOW MASTER STATUS, File, 1) +--let $slave_after_tr02_show_master_status_position=query_get_value(SHOW MASTER STATUS, Position, 1) +--let $slave_after_tr02_gtid_binlog_pos=`SELECT @@global.gtid_binlog_pos` + + +--echo ### Master: Checking SHOW BINLOG EVENTS + +--connection master +--vertical_results +### The BEGIN event +--replace_column 4 # 5 # +--replace_result $master_after_tr01_show_master_status_file master_after_tr01_show_master_status_file $master_after_tr01_show_master_status_position master_after_tr01_show_master_status_position $master_after_tr02_gtid_binlog_pos master_after_tr02_gtid_binlog_pos +--eval SHOW BINLOG EVENTS IN '$master_after_tr01_show_master_status_file' FROM $master_after_tr01_show_master_status_position LIMIT 0,1 +### The INSERT event +--replace_column 2 # 4 # 5 # +--replace_result $master_after_tr01_show_master_status_file master_after_tr01_show_master_status_file $master_after_tr01_show_master_status_position master_after_tr01_show_master_status_position +# Hide the difference between row and stmt binary logging +--replace_regex /use `test`; // /(Query|Annotate_rows)/Query_or_Annotate_rows/ +--eval SHOW BINLOG EVENTS IN '$master_after_tr01_show_master_status_file' FROM $master_after_tr01_show_master_status_position LIMIT 1,1 +--horizontal_results + +--echo ### Slave: Checking SHOW BINLOG EVENTS +--connection slave +--vertical_results +### The BEGIN event +--replace_column 2 # 5 # +--replace_result $slave_after_tr01_show_master_status_file slave_after_tr01_show_master_status_file $slave_after_tr01_show_master_status_position slave_after_tr01_show_master_status_position $slave_after_tr02_gtid_binlog_pos slave_after_tr02_gtid_binlog_pos +--eval SHOW BINLOG EVENTS IN '$slave_after_tr01_show_master_status_file' FROM $slave_after_tr01_show_master_status_position LIMIT 0,1 +### The INSERT event +--replace_column 2 # 4 # 5 # +--replace_result $slave_after_tr01_show_master_status_file slave_after_tr01_show_master_status_file $slave_after_tr01_show_master_status_position slave_after_tr01_show_master_status_position $slave_after_tr02_gtid_binlog_pos slave_after_tr02_gtid_binlog_pos +# Hide the difference between row and stmt binary logging +--replace_regex /use `test`; // /(Query|Annotate_rows)/Query_or_Annotate_rows/ +--eval SHOW BINLOG EVENTS IN '$slave_after_tr01_show_master_status_file' FROM $slave_after_tr01_show_master_status_position LIMIT 1,1 +--horizontal_results + +--echo ### Slave: Stop replication +--connection slave +STOP SLAVE; +--source include/wait_for_slave_to_stop.inc +RESET SLAVE; + +--echo ### Slave: Shutdown the server + +if ($cnf == "mariadb_to_mariadb") +{ + --let $rpl_server_number= 2 + --source include/rpl_stop_server.inc +} + +if ($cnf == "galera2_to_mariadb") +{ + --connection slave + --source $MYSQL_TEST_DIR/include/shutdown_mysqld.inc +} + +--echo ### Master: Run a transaction while the slave is shut down +--connection master +START TRANSACTION; +INSERT INTO t1 VALUES ('tr#03:stmt#00 - after slave run#0, slave is shut down, after backup'); +INSERT INTO t1 VALUES ('tr#03:stmt#01 - after slave run#0, slave is shut down, after backup'); +INSERT INTO t1 VALUES ('tr#03:stmt#02 - after slave run#0, slave is shut down, after backup'); +COMMIT; + + +--echo ############################################################## +--echo ### Emulate starting a new virgin slave + +--echo ### Slave: Remove the data directory +--rmdir $MYSQLD_DATADIR_SLAVE + +--echo ### Slave: Copy back the backup +--exec $XTRABACKUP $XTRABACKUP_COPY_BACK_OPTIONS --copy-back --datadir=$MYSQLD_DATADIR_SLAVE --target-dir=$backup_slave + +--echo ### Slave: Restart the server +if ($cnf == "mariadb_to_mariadb") +{ + --let $rpl_server_number= 2 + --source include/rpl_start_server.inc + --source include/wait_until_connected_again.inc +} + +if ($cnf == "galera2_to_mariadb") +{ + --connection slave + --source $MYSQL_TEST_DIR/include/start_mysqld.inc +} + +--echo ### Slave: Display the restored data before START SLAVE +--connection slave +SELECT * FROM t1 ORDER BY a; + +--echo ### Slave: Execute the CHANGE MASTER statement to set up the host and port +--replace_result $MASTER_MYPORT ### +--eval CHANGE MASTER '' TO MASTER_USER='root', MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_CONNECT_RETRY=1 + +--echo ### Slave: Execute the CHANGE MASTER statement from xtrabackup_slave_info +--replace_result $master_after_tr01_show_master_status_file master_after_tr01_show_master_status_file $master_after_tr01_show_master_status_position master_after_tr01_show_master_status_position +--source $backup_slave/xtrabackup_slave_info + +--echo ### Slave: Execute START SLAVE +--source include/start_slave.inc + +--echo ### Master: Wait for the slave to apply all master events +--connection master +--sync_slave_with_master slave + +--echo ### Slave: Make sure replication is not using GTID after the slave restart +--connection slave +--let $value= query_get_value(SHOW SLAVE STATUS, "Using_Gtid", 1) +--echo # Using_Gtid=$value + +--echo ### Slave: Display the restored data after START SLAVE +--connection slave +SELECT * FROM t1 ORDER BY a; + + +--echo ############################################################## +--echo ### Continue master transactions, check the new slave replicates well. + +--echo ### Master: Run a transaction after restarting replication +--connection master +START TRANSACTION; +INSERT INTO t1 VALUES ('tr#04:stmt#00 - slave run#1'); +INSERT INTO t1 VALUES ('tr#04:stmt#01 - slave run#1'); +INSERT INTO t1 VALUES ('tr#04:stmt#02 - slave run#1'); +COMMIT; +--sync_slave_with_master + +--echo ### Slave: Display the restored data + new transactions +--connection slave +SELECT * FROM t1 ORDER BY a; + + +--echo ############################################################## +--echo ### Cleanup + +--echo ### Removing the backup directory +--rmdir $backup_slave + +--connection master +DROP TABLE t1; +--sync_slave_with_master + +if ($cnf == "mariadb_to_mariadb") +{ + --source include/rpl_end.inc +} + +if ($cnf == "galera2_to_mariadb") +{ + STOP SLAVE; + --source include/wait_for_slave_to_stop.inc + RESET SLAVE ALL; + + --connection master + set global wsrep_on=OFF; + RESET MASTER; + set global wsrep_on=ON; +} diff --git a/mysql-test/include/rpl_start_server.inc b/mysql-test/include/rpl_start_server.inc index 932fc9da..0479dbbd 100644 --- a/mysql-test/include/rpl_start_server.inc +++ b/mysql-test/include/rpl_start_server.inc @@ -49,7 +49,7 @@ if ($rpl_server_parameters) --source include/rpl_connection.inc # Write file to make mysql-test-run.pl start up the server again ---exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect +--write_line "$_rpl_start_server_command" $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect if (!$rpl_server_error) { diff --git a/mysql-test/include/rpl_stop_server.inc b/mysql-test/include/rpl_stop_server.inc index 470e86a1..1e4a64cc 100644 --- a/mysql-test/include/rpl_stop_server.inc +++ b/mysql-test/include/rpl_stop_server.inc @@ -44,7 +44,7 @@ if ($rpl_debug) # Write file to make mysql-test-run.pl expect the "crash", but don't start # it until it's told to ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect # Send shutdown to the connected server and give # it 60 seconds (of mysqltest's default) to die before zapping it diff --git a/mysql-test/include/search_pattern_in_file.inc b/mysql-test/include/search_pattern_in_file.inc index 3105f7f9..ab3c95fc 100644 --- a/mysql-test/include/search_pattern_in_file.inc +++ b/mysql-test/include/search_pattern_in_file.inc @@ -9,9 +9,6 @@ # # The environment variables SEARCH_FILE and SEARCH_PATTERN must be set # before sourcing this routine. -# SEARCH_TYPE can also be set to either NULL(default) or _gm_ -# NULL is equivalent of using m/SEARCH_PATTERN/gs -# _gm_ is equivalent of using m/SEARCH_RANGE/gm # # Optionally, SEARCH_RANGE can be set to the max number of bytes of the file # to search. If negative, it will search that many bytes at the end of the @@ -25,6 +22,7 @@ # Supported formats: # - (default) : "FOUND n /pattern/ in FILE " or "NOT FOUND ..." # - "matches" : Each match is printed, on a separate line +# - "count" : "FOUND n matches in FILE" or "NOT FOUND ..." (omit pattern) # # In case of # - SEARCH_FILE and/or SEARCH_PATTERN is not set @@ -38,7 +36,7 @@ # let SEARCH_FILE= $error_log; # # Stop the server # let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; -# --exec echo "wait" > $restart_file +# --write_line wait $restart_file # --shutdown_server # --source include/wait_until_disconnected.inc # @@ -51,15 +49,12 @@ # Created: 2011-11-11 mleich # ---error 0,1 perl; use strict; die "SEARCH_FILE not set" unless $ENV{SEARCH_FILE}; my @search_files= glob($ENV{SEARCH_FILE}); my $search_pattern= $ENV{SEARCH_PATTERN} or die "SEARCH_PATTERN not set"; my $search_range= $ENV{SEARCH_RANGE}; - my $silent= $ENV{SEARCH_SILENT}; - my $search_result= 0; my $content; foreach my $search_file (@search_files) { open(FILE, '<', $search_file) || die("Can't open file $search_file: $!"); @@ -83,48 +78,23 @@ perl; close(FILE); $content.= $file_content; } - my @matches; - if (not defined($ENV{SEARCH_TYPE})) - { - @matches=($content =~ /$search_pattern/gs); - } - elsif($ENV{SEARCH_TYPE} == "_gm_") - { - @matches=($content =~ /$search_pattern/gm); - } - my $res; - if (@matches) - { - $res="FOUND " . scalar(@matches); - $search_result= 1; - } - else - { - $res= "NOT FOUND"; - } + my @matches= ($content =~ /$search_pattern/gs); + my $res=@matches ? "FOUND " . scalar(@matches) : "NOT FOUND"; + $ENV{SEARCH_FILE} =~ s{^.*?([^/\\]+)$}{$1}; - if (!$silent || $search_result) - { - if ($ENV{SEARCH_OUTPUT} eq "matches") - { - foreach (@matches) - { - print $_ . "\n"; - } - } - else - { - print "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n"; + if ($ENV{SEARCH_OUTPUT} eq "matches") { + foreach (@matches) { + print $_ . "\n"; } } - die "$ENV{SEARCH_ABORT}\n" - if $ENV{SEARCH_ABORT} && $res =~ /^$ENV{SEARCH_ABORT}/; - exit($search_result != 1); + elsif ($ENV{SEARCH_OUTPUT} eq "count") + { + print "$res matches in $ENV{SEARCH_FILE}\n"; + } + elsif ($ENV{SEARCH_ABORT} and $res =~ /^$ENV{SEARCH_ABORT}/) { + die "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n"; + } else { + print "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n"; + } EOF - -let $SEARCH_RESULT= 1; # Found pattern -if ($errno) -{ - let $SEARCH_RESULT= 0; # Did not find pattern -} diff --git a/mysql-test/include/shutdown_mysqld.inc b/mysql-test/include/shutdown_mysqld.inc index fc297256..1684d819 100644 --- a/mysql-test/include/shutdown_mysqld.inc +++ b/mysql-test/include/shutdown_mysqld.inc @@ -24,18 +24,15 @@ if ($rpl_inited) # Write file to make mysql-test-run.pl expect the "crash", but don't start it --let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect ---exec echo "wait" > $_expect_file_name +--write_line wait $_expect_file_name # Avoid warnings from connection threads that does not have time to exit --disable_query_log set @@global.log_warnings=0; --enable_query_log ---let $server_shutdown_timeout= 60 -if ($VALGRIND_TEST) -{ - --let $server_shutdown_timeout= 300 -} +--source include/slow_environ.inc +--let $server_shutdown_timeout= 60$_timeout_adjustment if ($shutdown_timeout) { diff --git a/mysql-test/include/slow_environ.inc b/mysql-test/include/slow_environ.inc new file mode 100644 index 00000000..761147fd --- /dev/null +++ b/mysql-test/include/slow_environ.inc @@ -0,0 +1,9 @@ +if (!$slow_environ_check) +{ + let $_timeout_adjustment=; + if (`select $VALGRIND_TEST + count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like '%SAN%'`) + { + let $_timeout_adjustment=0; + } + let $slow_environ_check=1; +} diff --git a/mysql-test/include/start_mysqld.inc b/mysql-test/include/start_mysqld.inc index 6e448cb2..91b06997 100644 --- a/mysql-test/include/start_mysqld.inc +++ b/mysql-test/include/start_mysqld.inc @@ -21,7 +21,7 @@ if ($restart_bindir) if ($restart_parameters) { - --exec echo "$restart_cmd: $restart_parameters" > $_expect_file_name + --write_line "$restart_cmd: $restart_parameters" $_expect_file_name if (!$restart_noprint) { --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -34,7 +34,7 @@ if ($restart_parameters) } if (!$restart_parameters) { - --exec echo "$restart_cmd" > $_expect_file_name + --write_line "$restart_cmd" $_expect_file_name if ($restart_noprint < 2) { --exec echo "# $restart_cmd" diff --git a/mysql-test/include/stop_slave_io.inc b/mysql-test/include/stop_slave_io.inc index ddc83782..a9d97f2f 100644 --- a/mysql-test/include/stop_slave_io.inc +++ b/mysql-test/include/stop_slave_io.inc @@ -34,8 +34,17 @@ if (!$rpl_debug) --disable_query_log } - +let $_enable_warnings=0; +if ($rpl_allow_error) { + if ($ENABLED_WARNINGS) { + let $_enable_warnings=1; + disable_warnings; + } +} STOP SLAVE IO_THREAD; +if ($_enable_warnings) { + enable_warnings; +} --source include/wait_for_slave_io_to_stop.inc diff --git a/mysql-test/include/sync_slave_sql_with_io.inc b/mysql-test/include/sync_slave_sql_with_io.inc index 9efede9a..c16d28ed 100644 --- a/mysql-test/include/sync_slave_sql_with_io.inc +++ b/mysql-test/include/sync_slave_sql_with_io.inc @@ -25,11 +25,8 @@ let $_slave_timeout= $slave_timeout; if (!$_slave_timeout) { - let $_slave_timeout= 300; - if ($VALGRIND_TEST) - { - let $_slave_timeout= 1500; - } + source include/slow_environ.inc; + let $_slave_timeout= 300$_timeout_adjustment; } --let $_master_log_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1) diff --git a/mysql-test/include/sync_with_master_gtid.inc b/mysql-test/include/sync_with_master_gtid.inc index 777711b9..0ca2c907 100644 --- a/mysql-test/include/sync_with_master_gtid.inc +++ b/mysql-test/include/sync_with_master_gtid.inc @@ -33,11 +33,8 @@ let $_slave_timeout= $slave_timeout; if (!$_slave_timeout) { - let $_slave_timeout= 120; - if ($VALGRIND_TEST) - { - let $_slave_timeout= 1200; - } + source include/slow_environ.inc; + let $_slave_timeout= 120$_timeout_adjustment; } --let $_result= `SELECT master_gtid_wait('$master_pos', $_slave_timeout)` diff --git a/mysql-test/include/wait_for_pattern_in_file.inc b/mysql-test/include/wait_for_pattern_in_file.inc index 52226acd..a5517610 100644 --- a/mysql-test/include/wait_for_pattern_in_file.inc +++ b/mysql-test/include/wait_for_pattern_in_file.inc @@ -25,23 +25,23 @@ if (!$_timeout) } let $_timeout_counter=`SELECT $_timeout * 10`; -let SEARCH_SILENT=1; - +let SEARCH_ABORT=NOT FOUND; let $_continue= 1; +disable_abort_on_error; while ($_continue) { source include/search_pattern_in_file.inc; - if ($SEARCH_RESULT) + if (!$errno) { # Found match let $_continue= 0; } - if (!$SEARCH_RESULT) + if ($errno) { dec $_timeout_counter; if ($_timeout_counter == 1) { - let $SEARCH_SILENT= 0; + enable_abort_on_error; } if (!$_timeout_counter) { @@ -49,8 +49,7 @@ while ($_continue) } } } - -let SEARCH_SILENT=0; +enable_abort_on_error; --source include/end_include_file.inc --let $keep_include_silent=$wait_save_keep_include_silent diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc index ed81c559..6802cd41 100644 --- a/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-test/include/wait_for_slave_param.inc @@ -49,11 +49,8 @@ let $_slave_timeout= $slave_timeout; if (!$_slave_timeout) { - let $_slave_timeout= 300; - if ($VALGRIND_TEST) - { - let $_slave_timeout= 1500; - } + source include/slow_environ.inc; + let $_slave_timeout= 300$_timeout_adjustment; } let $_slave_param_comparison= $slave_param_comparison; diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc index deb6ca13..2b20c780 100644 --- a/mysql-test/include/wait_until_connected_again.inc +++ b/mysql-test/include/wait_until_connected_again.inc @@ -11,7 +11,7 @@ let $counter= 5000; let $mysql_errno= 9999; while ($mysql_errno) { - --error 0,ER_ACCESS_DENIED_ERROR,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,ER_LOCK_WAIT_TIMEOUT,2002,2006,2013,HA_ERR_NO_ENCRYPTION + --error 0,ER_ACCESS_DENIED_ERROR,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,ER_LOCK_WAIT_TIMEOUT,2002,2006,2013,HA_ERR_NO_ENCRYPTION,2026 select 1; dec $counter; |