File: rpl_sql_thread_error.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (54 lines) | stat: -rw-r--r-- 1,890 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
###############################################################################
#
# Bug#21697821 RELAYLOG.LOG_LOCK IS NOT RELEASED IN
#  AN ERROR CASE (IN NEXT_EVENT())
#
# Problem: In an error case, relaylog.log_lock acquired by SQL thread is not
#          released which is causing all threads, which are looking to acquire
#          the lock,  to hang forever.
#
# Steps to reproduce:
#
#  1) Inject sql thread error using a simulation point and start SQL thread.
#
#  2) Wait till SQL thread goes down (before fix, it wont release the log_lock).
#
#  3) start SQL thread (before fix, it will wait for log_lock)
#
#  4) After the fix, make sure the replication is working fine.
#
###############################################################################

--source include/have_debug.inc
--source include/have_binlog_format_statement.inc
--let rpl_skip_start_slave=1
--source include/master-slave.inc

# Step 1) Set a simulation on Slave SQL thread so that it enters
# into faulty code (before fix) path.
--source include/rpl_connection_slave.inc
CALL mtr.add_suppression("Relay log read failure");
SET @save_debug=@@GLOBAL.debug;
SET GLOBAL debug="+d,force_sql_thread_error";

# Start SQL thread
START SLAVE SQL_THREAD;

# Step 2) Wait for SQL thread to go down with the injected error.
# Before fix, SQL thread would not have released
# relay_log.log_lock.
--let $slave_sql_errno= convert_error(ER_REPLICA_RELAY_LOG_READ_FAILURE)
--source include/wait_for_slave_sql_to_stop.inc

# Step 3) Before fix, when SQL thread is trying to acquire
# relay_log.log_lock which was not released will hang
# forever.
SET GLOBAL debug=@save_debug;
--source include/start_slave.inc

# Step 4) Execute dummy statements on master and see that it
#         replication is working fine.
--source include/rpl_connection_master.inc
CREATE TABLE t1(i INT);
DROP TABLE t1;
--source include/rpl_end.inc