-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- created binlog_encryption test suite and added it to the default list - moved some tests from rpl, binlog and multisource suites to extra so that they could be re-used in different suites - made minor changes in include files
- Loading branch information
Showing
190 changed files
with
18,153 additions
and
8,379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# | ||
# This include file is used by more than one test suite | ||
# (currently rpl and binlog_encryption). | ||
# Please check all dependent tests after modifying it | ||
# | ||
# Usage: | ||
# | ||
# --let $use_remote_mysqlbinlog= 1 # optional | ||
# --let $binlog_start_pos= <binlog position> # optional | ||
# --let $binlog_file= <binlog filename> # optional | ||
# | ||
# --source extra/binlog_tests/binlog_incident.inc | ||
# | ||
# The script uses MYSQLBINLOG to verify certain results. | ||
# By default, it uses binary logs directly. If it is undesirable, | ||
# this behavior can be overridden by setting $use_remote_binlog | ||
# as shown above. | ||
# | ||
# All values will be unset after every execution of the script, | ||
# so if they are needed, they should be set explicitly before each call. | ||
# | ||
|
||
# The purpose of this test is to provide a reference for how the | ||
# incident log event is represented in the output from the mysqlbinlog | ||
# program. | ||
|
||
source include/have_log_bin.inc; | ||
source include/have_debug.inc; | ||
source include/binlog_start_pos.inc; | ||
|
||
let $MYSQLD_DATADIR= `select @@datadir`; | ||
RESET MASTER; | ||
|
||
CREATE TABLE t1 (a INT); | ||
|
||
INSERT INTO t1 VALUES (1),(2),(3); | ||
SELECT * FROM t1; | ||
|
||
# This will generate an incident log event and store it in the binary | ||
# log before the replace statement. | ||
REPLACE INTO t1 VALUES (4); | ||
|
||
DROP TABLE t1; | ||
FLUSH LOGS; | ||
|
||
if ($binlog_start_pos) | ||
{ | ||
--let $startpos= --start-position=$binlog_start_pos | ||
--let $binlog_start_pos= | ||
} | ||
--let $filename= master-bin.000001 | ||
if ($binlog_file) | ||
{ | ||
--let $filename= $binlog_file | ||
--let $binlog_file= | ||
} | ||
--let $mysqlbinlog_args= $MYSQLD_DATADIR/$filename | ||
if ($use_remote_mysqlbinlog) | ||
{ | ||
--let $mysqlbinlog_args= --read-from-remote-server --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT -uroot $filename | ||
--let $use_remote_mysqlbinlog= 0 | ||
} | ||
exec $MYSQL_BINLOG $startpos $mysqlbinlog_args >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; | ||
--disable_query_log | ||
eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl; | ||
--enable_query_log | ||
|
||
remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,278 @@ | ||
# | ||
# This include file is used by more than one test suite | ||
# (currently binlog and binlog_encryption). | ||
# Please check all dependent tests after modifying it | ||
# | ||
|
||
# | ||
# testing of purging of binary log files bug#18199/Bug#18453 | ||
# | ||
source include/have_log_bin.inc; | ||
source include/not_embedded.inc; | ||
# Don't test this under valgrind, memory leaks will occur | ||
--source include/not_valgrind.inc | ||
source include/have_debug.inc; | ||
# Avoid CrashReporter popup on Mac | ||
--source include/not_crashrep.inc | ||
call mtr.add_suppression('Attempting backtrace'); | ||
call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.'); | ||
call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file'); | ||
call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); | ||
call mtr.add_suppression('Could not open .*'); | ||
call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); | ||
flush tables; | ||
|
||
let $old=`select @@debug`; | ||
|
||
RESET MASTER; | ||
|
||
let $MYSQLD_DATADIR= `select @@datadir`; | ||
let $INDEX=$MYSQLD_DATADIR/master-bin.index; | ||
|
||
# | ||
# testing purge binary logs TO | ||
# | ||
|
||
flush logs; | ||
flush logs; | ||
flush logs; | ||
|
||
source include/show_binary_logs.inc; | ||
remove_file $MYSQLD_DATADIR/master-bin.000001; | ||
flush tables; | ||
|
||
# there must be a warning with file names | ||
replace_regex /\.[\\\/]master/master/; | ||
--source include/wait_for_binlog_checkpoint.inc | ||
purge binary logs TO 'master-bin.000004'; | ||
|
||
--echo *** must show a list starting from the 'TO' argument of PURGE *** | ||
source include/show_binary_logs.inc; | ||
|
||
# | ||
# testing purge binary logs BEFORE | ||
# | ||
|
||
reset master; | ||
|
||
flush logs; | ||
flush logs; | ||
flush logs; | ||
remove_file $MYSQLD_DATADIR/master-bin.000001; | ||
|
||
--echo *** must be a warning master-bin.000001 was not found *** | ||
let $date=`select NOW() + INTERVAL 1 MINUTE`; | ||
--disable_query_log | ||
replace_regex /\.[\\\/]master/master/; | ||
--source include/wait_for_binlog_checkpoint.inc | ||
eval purge binary logs BEFORE '$date'; | ||
--enable_query_log | ||
|
||
--echo *** must show one record, of the active binlog, left in the index file after PURGE *** | ||
source include/show_binary_logs.inc; | ||
|
||
# | ||
# testing a fatal error | ||
# Turning a binlog file into a directory must be a portable setup | ||
# | ||
|
||
reset master; | ||
|
||
flush logs; | ||
flush logs; | ||
flush logs; | ||
|
||
remove_file $MYSQLD_DATADIR/master-bin.000001; | ||
mkdir $MYSQLD_DATADIR/master-bin.000001; | ||
|
||
--source include/wait_for_binlog_checkpoint.inc | ||
--error ER_BINLOG_PURGE_FATAL_ERR | ||
purge binary logs TO 'master-bin.000002'; | ||
replace_regex /\.[\\\/]master/master/; | ||
show warnings; | ||
rmdir $MYSQLD_DATADIR/master-bin.000001; | ||
--disable_warnings | ||
reset master; | ||
--enable_warnings | ||
|
||
--echo # crash_purge_before_update_index | ||
flush logs; | ||
|
||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
SET SESSION debug_dbug="+d,crash_purge_before_update_index"; | ||
--source include/wait_for_binlog_checkpoint.inc | ||
--error 2013 | ||
purge binary logs TO 'master-bin.000002'; | ||
|
||
--enable_reconnect | ||
--source include/wait_until_connected_again.inc | ||
|
||
file_exists $MYSQLD_DATADIR/master-bin.000001; | ||
file_exists $MYSQLD_DATADIR/master-bin.000002; | ||
file_exists $MYSQLD_DATADIR/master-bin.000003; | ||
--chmod 0644 $INDEX | ||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
-- eval SET @index=LOAD_FILE('$index') | ||
-- replace_regex /\.[\\\/]master/master/ | ||
SELECT @index; | ||
|
||
--echo # crash_purge_non_critical_after_update_index | ||
flush logs; | ||
|
||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
SET SESSION debug_dbug="+d,crash_purge_non_critical_after_update_index"; | ||
--source include/wait_for_binlog_checkpoint.inc | ||
--error 2013 | ||
purge binary logs TO 'master-bin.000004'; | ||
|
||
--enable_reconnect | ||
--source include/wait_until_connected_again.inc | ||
|
||
--error 1 | ||
file_exists $MYSQLD_DATADIR/master-bin.000001; | ||
--error 1 | ||
file_exists $MYSQLD_DATADIR/master-bin.000002; | ||
--error 1 | ||
file_exists $MYSQLD_DATADIR/master-bin.000003; | ||
--chmod 0644 $INDEX | ||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
-- eval SET @index=LOAD_FILE('$index') | ||
-- replace_regex /\.[\\\/]master/master/ | ||
SELECT @index; | ||
|
||
--echo # crash_purge_critical_after_update_index | ||
flush logs; | ||
|
||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
SET SESSION debug_dbug="+d,crash_purge_critical_after_update_index"; | ||
--source include/wait_for_binlog_checkpoint.inc | ||
--error 2013 | ||
purge binary logs TO 'master-bin.000006'; | ||
|
||
--enable_reconnect | ||
--source include/wait_until_connected_again.inc | ||
|
||
--error 1 | ||
file_exists $MYSQLD_DATADIR/master-bin.000004; | ||
--error 1 | ||
file_exists $MYSQLD_DATADIR/master-bin.000005; | ||
file_exists $MYSQLD_DATADIR/master-bin.000006; | ||
file_exists $MYSQLD_DATADIR/master-bin.000007; | ||
--error 1 | ||
file_exists $MYSQLD_DATADIR/master-bin.000008; | ||
--chmod 0644 $INDEX | ||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
-- eval SET @index=LOAD_FILE('$index') | ||
-- replace_regex /\.[\\\/]master/master/ | ||
SELECT @index; | ||
|
||
--echo # crash_create_non_critical_before_update_index | ||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
SET SESSION debug_dbug="+d,crash_create_non_critical_before_update_index"; | ||
--error 2013 | ||
flush logs; | ||
|
||
--enable_reconnect | ||
--source include/wait_until_connected_again.inc | ||
|
||
file_exists $MYSQLD_DATADIR/master-bin.000008; | ||
--error 1 | ||
file_exists $MYSQLD_DATADIR/master-bin.000009; | ||
--chmod 0644 $INDEX | ||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
-- eval SET @index=LOAD_FILE('$index') | ||
-- replace_regex /\.[\\\/]master/master/ | ||
SELECT @index; | ||
|
||
--echo # crash_create_critical_before_update_index | ||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
SET SESSION debug_dbug="+d,crash_create_critical_before_update_index"; | ||
--error 2013 | ||
flush logs; | ||
|
||
--enable_reconnect | ||
--source include/wait_until_connected_again.inc | ||
|
||
file_exists $MYSQLD_DATADIR/master-bin.000009; | ||
--error 1 | ||
file_exists $MYSQLD_DATADIR/master-bin.000010; | ||
--error 1 | ||
file_exists $MYSQLD_DATADIR/master-bin.000011; | ||
--chmod 0644 $INDEX | ||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
-- eval SET @index=LOAD_FILE('$index') | ||
-- replace_regex /\.[\\\/]master/master/ | ||
SELECT @index; | ||
|
||
--echo # crash_create_after_update_index | ||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
SET SESSION debug_dbug="+d,crash_create_after_update_index"; | ||
--error 2013 | ||
flush logs; | ||
|
||
--enable_reconnect | ||
--source include/wait_until_connected_again.inc | ||
|
||
file_exists $MYSQLD_DATADIR/master-bin.000010; | ||
file_exists $MYSQLD_DATADIR/master-bin.000011; | ||
--chmod 0644 $INDEX | ||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
-- eval SET @index=LOAD_FILE('$index') | ||
-- replace_regex /\.[\\\/]master/master/ | ||
SELECT @index; | ||
|
||
--echo # | ||
--echo # This should put the server in unsafe state and stop | ||
--echo # accepting any command. If we inject a fault at this | ||
--echo # point and continue the execution the server crashes. | ||
--echo # | ||
|
||
--chmod 0644 $INDEX | ||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
-- eval SET @index=LOAD_FILE('$index') | ||
-- replace_regex /\.[\\\/]master/master/ | ||
SELECT @index; | ||
|
||
--echo # fault_injection_registering_index | ||
SET SESSION debug_dbug="+d,fault_injection_registering_index"; | ||
-- replace_regex /\.[\\\/]master/master/ | ||
-- error ER_CANT_OPEN_FILE | ||
flush logs; | ||
|
||
--chmod 0644 $INDEX | ||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
-- eval SET @index=LOAD_FILE('$index') | ||
-- replace_regex /\.[\\\/]master/master/ | ||
SELECT @index; | ||
|
||
--source include/restart_mysqld.inc | ||
|
||
--chmod 0644 $INDEX | ||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
-- eval SET @index=LOAD_FILE('$index') | ||
-- replace_regex /\.[\\\/]master/master/ | ||
SELECT @index; | ||
|
||
--echo # fault_injection_updating_index | ||
SET SESSION debug_dbug="+d,fault_injection_updating_index"; | ||
-- replace_regex /\.[\\\/]master/master/ | ||
-- error ER_CANT_OPEN_FILE | ||
flush logs; | ||
|
||
--chmod 0644 $INDEX | ||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
-- eval SET @index=LOAD_FILE('$index') | ||
-- replace_regex /\.[\\\/]master/master/ | ||
SELECT @index; | ||
|
||
--source include/restart_mysqld.inc | ||
|
||
--chmod 0644 $INDEX | ||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
-- eval SET @index=LOAD_FILE('$index') | ||
-- replace_regex /\.[\\\/]master/master/ | ||
SELECT @index; | ||
|
||
eval SET SESSION debug_dbug="$old"; | ||
|
||
--echo End of tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# This include file is used by more than one test suite | ||
# (currently binlog and binlog_encryption). | ||
# Please check all dependent tests after modifying it | ||
# | ||
|
||
source include/have_debug.inc; | ||
source include/have_innodb.inc; | ||
source include/have_log_bin.inc; | ||
source include/have_binlog_format_mixed_or_statement.inc; | ||
|
||
CALL mtr.add_suppression("Error writing file 'master-bin'"); | ||
|
||
RESET MASTER; | ||
|
||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; | ||
INSERT INTO t1 VALUES(0); | ||
SET SESSION debug_dbug='+d,fail_binlog_write_1'; | ||
--error ER_ERROR_ON_WRITE | ||
INSERT INTO t1 VALUES(1); | ||
--error ER_ERROR_ON_WRITE | ||
INSERT INTO t1 VALUES(2); | ||
SET SESSION debug_dbug=''; | ||
INSERT INTO t1 VALUES(3); | ||
SELECT * FROM t1; | ||
|
||
# Actually the output from this currently shows a bug. | ||
# The injected IO error leaves partially written transactions in the binlog in | ||
# the form of stray "BEGIN" events. | ||
# These should disappear from the output if binlog error handling is improved | ||
# (see MySQL Bug#37148 and WL#1790). | ||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ | ||
--replace_column 1 BINLOG 2 POS 5 ENDPOS | ||
SHOW BINLOG EVENTS; | ||
|
||
DROP TABLE t1; |
Oops, something went wrong.