| 1 |
############################################################################### |
| 2 |
# |
| 3 |
# Bug#21697821 RELAYLOG.LOG_LOCK IS NOT RELEASED IN |
| 4 |
# AN ERROR CASE (IN NEXT_EVENT()) |
| 5 |
# |
| 6 |
# Problem: In an error case, relaylog.log_lock acquired by SQL thread is not |
| 7 |
# released which is causing all threads, which are looking to acquire |
| 8 |
# the lock, to hang forever. |
| 9 |
# |
| 10 |
# Steps to reproduce: |
| 11 |
# |
| 12 |
# 1) Inject sql thread error using a simulation point and start SQL thread. |
| 13 |
# |
| 14 |
# 2) Wait till SQL thread goes down (before fix, it wont release the log_lock). |
| 15 |
# |
| 16 |
# 3) start SQL thread (before fix, it will wait for log_lock) |
| 17 |
# |
| 18 |
# 4) After the fix, make sure the replication is working fine. |
| 19 |
# |
| 20 |
############################################################################### |
| 21 |
|
| 22 |
--source include/have_debug.inc |
| 23 |
--source include/have_binlog_format_statement.inc |
| 24 |
--let rpl_skip_start_slave=1 |
| 25 |
--source include/master-slave.inc |
| 26 |
|
| 27 |
# Step 1) Set a simulation on Slave SQL thread so that it enters |
| 28 |
# into faulty code (before fix) path. |
| 29 |
--source include/rpl_connection_slave.inc |
| 30 |
CALL mtr.add_suppression("Relay log read failure"); |
| 31 |
SET @save_debug=@@GLOBAL.debug; |
| 32 |
SET GLOBAL debug="+d,force_sql_thread_error"; |
| 33 |
|
| 34 |
# Start SQL thread |
| 35 |
START SLAVE SQL_THREAD; |
| 36 |
|
| 37 |
# Step 2) Wait for SQL thread to go down with the injected error. |
| 38 |
# Before fix, SQL thread would not have released |
| 39 |
# relay_log.log_lock. |
| 40 |
--let $slave_sql_errno= convert_error(ER_REPLICA_RELAY_LOG_READ_FAILURE) |
| 41 |
--source include/wait_for_slave_sql_to_stop.inc |
| 42 |
|
| 43 |
# Step 3) Before fix, when SQL thread is trying to acquire |
| 44 |
# relay_log.log_lock which was not released will hang |
| 45 |
# forever. |
| 46 |
SET GLOBAL debug=@save_debug; |
| 47 |
--source include/start_slave.inc |
| 48 |
|
| 49 |
# Step 4) Execute dummy statements on master and see that it |
| 50 |
# replication is working fine. |
| 51 |
--source include/rpl_connection_master.inc |
| 52 |
CREATE TABLE t1(i INT); |
| 53 |
DROP TABLE t1; |
| 54 |
--source include/rpl_end.inc |