Debian Codegraph @

mysql-test/suite/rpl/t/rpl_relay_log_space_synchronization.test

raw
1 # === Purpose ===
2 #
3 # This test verifies that SQL and IO threads update the
4 # rli->relay_log_space_total variable in a synchronized manner.
5 #
6 # === Implementation ===
7 #
8 # 1. On Slave, make the SQL thread to purge relay logs and halt
9 # the SQL thread in MYSQL_BIN_LOG::purge_index_entry function
10 # using debug sync utility.
11 # 2. Do a DML on master so that IO thread calls queue_event and
12 # updates rli->relay_log_space_total.
13 # 3. Verify that IO thread is waiting rli->log_space_lock until it is released
14 # by SQL thread.
15 #
16 # === References ===
17 #
18 # Bug#26997096 RELAY_LOG_SPACE IS INACCURATE AND LEAKS
19
20 # This test case is binlog_format agnostic
21 --source include/have_binlog_format_row.inc
22 # This test case uses debug_sync
23 --source include/have_debug.inc
24 --source include/have_debug_sync.inc
25 --source include/master-slave.inc
26
27 CREATE TABLE t1 (i INT);
28
29 --source include/sync_slave_sql_with_master.inc
30 --source include/stop_slave_sql.inc
31 SET GLOBAL debug='+d,wait_in_purge_index_entry';
32
33 # Create a new relay log so the START SLAVE SQL_THREAD tries
34 # to purge the old relay logs and hits the debug point.
35 FLUSH LOCAL RELAY LOGS;
36 START SLAVE SQL_THREAD;
37 SET DEBUG_SYNC="now WAIT_FOR in_purge_index_entry";
38
39 # Do a DML on master so that IO thread calls queue_event and
40 # updates rli->relay_log_space_total.
41 --source include/rpl_connection_master.inc
42 INSERT INTO t1 VALUES (1);
43 --source include/rpl_connection_slave.inc
44
45 # Wait until IO thread tries to take a log_space_lock.
46 --let $io_thread_id = `SELECT THREAD_ID FROM performance_schema.threads WHERE NAME like '%replica_io%'`
47 --let $wait_condition= SELECT EVENT_NAME= 'wait/synch/mutex/sql/Relay_log_info::log_space_lock' FROM performance_schema.events_waits_current WHERE THREAD_ID=$io_thread_id
48 --source include/wait_condition.inc
49
50 # Since SQL thread has taken the rli->log_space_lock, IO thread should wait until
51 # the lock is released. Assert that IO thread is waiting for rli->log_space_lock.
52 --let $assert_text= IO Thread is waiting for Relay_log_info::log_space_lock.
53 --let $assert_cond= "[SELECT EVENT_NAME FROM performance_schema.events_waits_current WHERE THREAD_ID=$io_thread_id]" = "wait/synch/mutex/sql/Relay_log_info::log_space_lock"
54 --source include/assert.inc
55
56 SET DEBUG_SYNC="now SIGNAL go_ahead_sql";
57
58 # Cleanup
59 --source include/rpl_connection_master.inc
60 DROP TABLE t1;
61 --source include/sync_slave_sql_with_master.inc
62 SET GLOBAL debug='-d,wait_in_purge_index_entry';
63 SET DEBUG_SYNC="RESET";
64 --source include/rpl_end.inc