Debian Codegraph @

mysql-test/suite/binlog/t/binlog_set_trans_dependency_deadlock.test

raw
1 # ==== Purpose ====
2 #
3 # Test verifies that there is no deadlock when following commands are executed
4 # in parallel.
5 #
6 # SHOW BINARY LOGS
7 #
8 # SELECT * FROM performance_schema.session_variables WHERE VARIABLE_NAME LIKE
9 # 'binlog_transaction_dependency_tracking'
10 #
11 # PURGE BINARY LOGS BEFORE $date;
12 #
13 # ==== Implementation ====
14 #
15 # With the help of DEBUG_SYNC operations simulate the deadlock environment.
16 #
17 # 1) PURGE LOGS BEFORE date
18 # Owns: MYSQL_BIN_LOG::LOCK_index
19 # Waits for: THD::LOCK_thd_data
20 #
21 # 2) select query on performance_schema.session_variables table
22 # Owns: THD::LOCK_thd_data
23 # Waits for: MYSQL_BIN_LOG::LOCK_log
24 #
25 # 3) SHOW BINARY LOGS
26 # Owns: MYSQL_BIN_LOG::LOCK_log
27 # Waits for: MYSQL_BIN_LOG::LOCK_index
28 #
29 # ==== References ====
30 #
31 # Bug#28511326: DEADLOCK DURING PURGE_LOGS_BEFORE_DATE
32
33 --source include/have_debug_sync.inc
34 --source include/have_log_bin.inc
35
36 --echo #
37 --echo # Bug 92108: Deadlock by concurrent SHOW BINLOGS,
38 --echo # performance_schema.session_variables query, and binlog purge
39 --echo #
40
41 RESET MASTER;
42 FLUSH LOGS;
43 --enable_connect_log
44 --connect(con1,localhost,root,,)
45
46 SET DEBUG_SYNC="purge_logs_after_lock_index_before_thread_count SIGNAL purge_ready WAIT_FOR finish_purge";
47
48 --send PURGE BINARY LOGS BEFORE '2038-01-19'
49
50 --connect(con2,localhost,root,,)
51
52 SET DEBUG_SYNC="materialize_session_variable_array_THD_locked SIGNAL pfs_ready WAIT_FOR finish_pfs";
53
54 --send SELECT * FROM performance_schema.session_variables WHERE VARIABLE_NAME LIKE 'binlog_transaction_dependency_tracking';
55
56 --connect(con3,localhost,root,,)
57
58 SET DEBUG_SYNC="show_binlogs_after_lock_log_before_lock_index SIGNAL show_ready WAIT_FOR finish_show";
59
60 --send SHOW BINARY LOGS
61
62 --connection default
63
64 SET DEBUG_SYNC="now WAIT_FOR purge_ready";
65 SET DEBUG_SYNC="now WAIT_FOR pfs_ready";
66 SET DEBUG_SYNC="now WAIT_FOR show_ready";
67
68 SET DEBUG_SYNC="now SIGNAL finish_purge";
69 SET DEBUG_SYNC="now SIGNAL finish_pfs";
70 SET DEBUG_SYNC="now SIGNAL finish_show";
71
72 --connection con1
73 replace_regex /\.[\\\/]binlog/binlog/;
74 reap;
75 --disconnect con1
76
77 --connection con2
78 reap;
79 --disconnect con2
80
81 --connection con3
82 --disable_result_log
83 reap;
84 --enable_result_log
85 --disconnect con3
86
87 --connection default
88
89 SET DEBUG_SYNC= 'RESET';
90 --disable_connect_log