mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
09c80e12c5
Major replication test framework cleanup. This does the following: - Ensure that all tests clean up the replication state when they finish, by making check-testcase check the output of SHOW SLAVE STATUS. This implies: - Slave must not be running after test finished. This is good because it removes the risk for sporadic errors in subsequent tests when a test forgets to sync correctly. - Slave SQL and IO errors must be cleared when test ends. This is good because we will notice if a test gets an unexpected error in the slave threads near the end. - We no longer have to clean up before a test starts. - Ensure that all tests that wait for an error in one of the slave threads waits for a specific error. It is no longer possible to source wait_for_slave_[sql|io]_to_stop.inc when there is an error in one of the slave threads. This is good because: - If a test expects an error but there is a bug that causes another error to happen, or if it stops the slave thread without an error, then we will notice. - When developing tests, wait_for_*_to_[start|stop].inc will fail immediately if there is an error in the relevant slave thread. Before this patch, we had to wait for the timeout. - Remove duplicated and repeated code for setting up unusual replication topologies. Now, there is a single file that is capable of setting up arbitrary topologies (include/rpl_init.inc, but include/master-slave.inc is still available for the most common topology). Tests can now end with include/rpl_end.inc, which will clean up correctly no matter what topology is used. The topology can be changed with include/rpl_change_topology.inc. - Improved debug information when tests fail. This includes: - debug info is printed on all servers configured by include/rpl_init.inc - User can set $rpl_debug=1, which makes auxiliary replication files print relevant debug info. - Improved documentation for all auxiliary replication files. Now they describe purpose, usage, parameters, and side effects. - Many small code cleanups: - Made have_innodb.inc output a sensible error message. - Moved contents of rpl000017-slave.sh into rpl000017.test - Added mysqltest variables that expose the current state of disable_warnings/enable_warnings and friends. - Too many to list here: see per-file comments for details.
106 lines
2.7 KiB
PHP
106 lines
2.7 KiB
PHP
# ==== Purpose ====
|
|
#
|
|
# Print status information for replication, typically used to debug
|
|
# test failures.
|
|
#
|
|
# The following is printed on the current connection:
|
|
#
|
|
# SELECT NOW()
|
|
# SHOW SLAVE STATUS
|
|
# SHOW MASTER STATUS
|
|
# SHOW PROCESSLIST
|
|
# SHOW BINLOG EVENTS IN <binlog_name>
|
|
#
|
|
# Where <binlog_name> is the currently active binlog.
|
|
#
|
|
# Then, the same is printed from all connections configured by
|
|
# rpl_init.inc - i.e., on connection server_N, where
|
|
# 1 <= N <= $rpl_server_count
|
|
#
|
|
#
|
|
# ==== Usage ====
|
|
#
|
|
# [--let $rpl_only_current_connection= 1]
|
|
# --source include/show_rpl_debug_info.inc
|
|
#
|
|
# Parameters:
|
|
# $rpl_only_current_connection
|
|
# By default, debug info is printed from all connections, starting
|
|
# with the current connection. If this variable is set, debug
|
|
# info is printed only for the current connection.
|
|
#
|
|
#
|
|
# ==== Side effects ====
|
|
#
|
|
# Turns on enable_query_log, enable_result_log, enable_warnings,
|
|
# horizontal_results, and enable_abort_on_error.
|
|
#
|
|
# Prints non-deterministic output to the query log. This file should
|
|
# never be called in a test that does not fail.
|
|
|
|
|
|
--enable_query_log
|
|
--enable_result_log
|
|
--enable_warnings
|
|
--disable_abort_on_error
|
|
--horizontal_results
|
|
|
|
|
|
--let $_rpl_old_con= $CURRENT_CONNECTION
|
|
--let $_rpl_is_first_server= 1
|
|
--let $_rpl_server= $rpl_server_count
|
|
--inc $_rpl_server
|
|
|
|
|
|
while ($_rpl_server)
|
|
{
|
|
if (!$_rpl_is_first_server)
|
|
{
|
|
--connection server_$_rpl_server
|
|
}
|
|
|
|
--echo
|
|
--echo ############################## $CURRENT_CONNECTION ##############################
|
|
--echo
|
|
--echo **** SHOW WARNINGS on $CURRENT_CONNECTION ****
|
|
SHOW WARNINGS;
|
|
--echo
|
|
--echo **** SELECT replication-related variables on $CURRENT_CONNECTION ****
|
|
SELECT NOW(), @@SERVER_ID;
|
|
--echo
|
|
--echo **** SHOW SLAVE STATUS on $CURRENT_CONNECTION ****
|
|
query_vertical SHOW SLAVE STATUS;
|
|
--echo
|
|
--echo **** SHOW MASTER STATUS on $CURRENT_CONNECTION ****
|
|
query_vertical SHOW MASTER STATUS;
|
|
--echo
|
|
--echo **** SHOW SLAVE HOSTS on $CURRENT_CONNECTION ****
|
|
query_vertical SHOW SLAVE HOSTS;
|
|
--echo
|
|
--echo **** SHOW PROCESSLIST on $CURRENT_CONNECTION ****
|
|
SHOW PROCESSLIST;
|
|
--echo
|
|
--echo **** SHOW BINARY LOGS on $CURRENT_CONNECTION ****
|
|
SHOW BINARY LOGS;
|
|
--echo
|
|
--echo **** SHOW BINLOG EVENTS on $CURRENT_CONNECTION ****
|
|
let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1);
|
|
--echo binlog_name = '$binlog_name'
|
|
eval SHOW BINLOG EVENTS IN '$binlog_name';
|
|
|
|
|
|
--let $_rpl_is_first_server= 0
|
|
--dec $_rpl_server
|
|
# Don't use same connection twice.
|
|
if (`SELECT 'server_$_rpl_server' = '$_rpl_old_con'`)
|
|
{
|
|
--dec $_rpl_server
|
|
if ($rpl_only_current_connection)
|
|
{
|
|
--let $_rpl_server= 0
|
|
}
|
|
}
|
|
}
|
|
|
|
--connection $_rpl_old_con
|
|
--enable_abort_on_error
|