summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl
diff options
context:
space:
mode:
authorAlfranio Correia <alfranio.correia@sun.com>2009-02-11 11:56:25 +0000
committerAlfranio Correia <alfranio.correia@sun.com>2009-02-11 11:56:25 +0000
commitf3314e90e31b1568f11e85ff06ec9659aff58101 (patch)
tree002546bb46d9ca29bd35f510929d73b91245ac07 /mysql-test/suite/rpl
parent4c67bc0c76833c3f7a9e161fc8be7e9b67e866fb (diff)
downloadmariadb-git-f3314e90e31b1568f11e85ff06ec9659aff58101.tar.gz
BUG#38197 Errors in @@init_slave not visible in 'show slave status'
Some errors that cause the slave SQL thread to stop are not shown in the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error is only in the server's error log. That makes it difficult to analyze the error for the user. One example of an error that stops the slave but is not shown by "SHOW SLAVE STATUS" is when @@global.init_slave is set incorrectly (e.g., it contains something that is not valid SQL). Three failures were not correctly reported: 1 - Failures during slave thread initialization 2 - Failures while initializing the relay log position right after starting the slave thread. 3 - Failures while processing queries passed through the init_slave option. This patch fixes the issues by reporting the errors through relay-info->report.
Diffstat (limited to 'mysql-test/suite/rpl')
-rw-r--r--mysql-test/suite/rpl/r/rpl_bug33931.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_bug38197.result18
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug33931.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug38197.test86
4 files changed, 112 insertions, 8 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result
index 1b3f2cfc7dc..85c8fb0da9c 100644
--- a/mysql-test/suite/rpl/r/rpl_bug33931.result
+++ b/mysql-test/suite/rpl/r/rpl_bug33931.result
@@ -1,5 +1,5 @@
reset master;
-call mtr.add_suppression("Failed during slave.*thread initialization");
+call mtr.add_suppression("Failed during slave thread initialization");
stop slave;
reset slave;
SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
@@ -23,8 +23,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
+Last_Errno #
+Last_Error Failed during slave thread initialization
Skip_Counter 0
Exec_Master_Log_Pos 0
Relay_Log_Space #
@@ -41,6 +41,6 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
+Last_SQL_Errno #
+Last_SQL_Error Failed during slave thread initialization
SET GLOBAL debug="";
diff --git a/mysql-test/suite/rpl/r/rpl_bug38197.result b/mysql-test/suite/rpl/r/rpl_bug38197.result
new file mode 100644
index 00000000000..ab957e6d9bc
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_bug38197.result
@@ -0,0 +1,18 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+reset slave;
+SET GLOBAL debug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
+start slave;
+Reporting the following error: Failed during slave thread initialization
+SET GLOBAL debug= "";
+stop slave;
+reset slave;
+SET GLOBAL init_slave= "garbage";
+start slave;
+Reporting the following error: Slave SQL thread aborted. Can't execute init_slave query
+SET GLOBAL init_slave= "";
diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test
index a439b346538..13f781c644b 100644
--- a/mysql-test/suite/rpl/t/rpl_bug33931.test
+++ b/mysql-test/suite/rpl/t/rpl_bug33931.test
@@ -15,7 +15,7 @@ reset master;
connection slave;
# Add suppression for expected warnings in slaves error log
-call mtr.add_suppression("Failed during slave.*thread initialization");
+call mtr.add_suppression("Failed during slave thread initialization");
--disable_warnings
stop slave;
@@ -37,8 +37,8 @@ connection slave;
#
source include/wait_for_slave_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 19 # 23 # 33 # 37 #
query_vertical show slave status;
#
diff --git a/mysql-test/suite/rpl/t/rpl_bug38197.test b/mysql-test/suite/rpl/t/rpl_bug38197.test
new file mode 100644
index 00000000000..4ca0de6ec66
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_bug38197.test
@@ -0,0 +1,86 @@
+######################################################################
+# Some errors that cause the slave SQL thread to stop are not shown in
+# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error
+# is only in the server's error log.
+#
+# Two failures and their respective reporting are verified:
+#
+# 1 - Failures during slave thread initialization
+# 2 - Failures while processing queries passed through the init_slave
+# option.
+#
+# In order to check the first type of failure, we inject a fault in the
+# SQL/IO Threads through SET GLOBAL debug.
+#
+# To check the second type, we set @@global.init_slave to an invalid
+# command thus preventing the initialization of the SQL Thread.
+#
+# Obs:
+# 1 - Note that testing failures while initializing the relay log position
+# is hard as the same function is called before the code reaches the point
+# that we want to test.
+#
+# 2 - This test does not target failures that are reported while applying
+# events such as duplicate keys, errors while reading the relay-log.bin*,
+# etc. Such errors are already checked on other tests.
+######################################################################
+
+######################################################################
+# Configuring the Environment
+######################################################################
+source include/have_debug.inc;
+source include/master-slave.inc;
+source include/have_log_bin.inc;
+
+connection slave;
+
+--disable_warnings
+stop slave;
+--enable_warnings
+reset slave;
+
+######################################################################
+# Injecting faults in the threads' initialization
+######################################################################
+connection slave;
+
+# Set debug flags on slave to force errors to occur
+SET GLOBAL debug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
+
+start slave;
+
+#
+# slave is going to stop because of emulated failures
+# but there won't be any crashes nor asserts hit.
+#
+source include/wait_for_slave_to_stop.inc;
+
+let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1);
+echo Reporting the following error: $error;
+
+SET GLOBAL debug= "";
+
+######################################################################
+# Injecting faults in the init_slave option
+######################################################################
+connection slave;
+
+--disable_warnings
+stop slave;
+--enable_warnings
+source include/wait_for_slave_to_stop.inc;
+
+reset slave;
+
+SET GLOBAL init_slave= "garbage";
+
+start slave;
+source include/wait_for_slave_sql_to_stop.inc;
+
+let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1);
+echo Reporting the following error: $error;
+
+######################################################################
+# Clean up
+######################################################################
+SET GLOBAL init_slave= "";