File: rpl_relay_log_space_synchronization.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 (64 lines) | stat: -rw-r--r-- 2,499 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
55
56
57
58
59
60
61
62
63
64
# === Purpose ===
#
# This test verifies that SQL and IO threads update the
# rli->relay_log_space_total variable in a synchronized manner.
#
# === Implementation ===
#
# 1. On Slave, make the SQL thread to purge relay logs and halt
#    the SQL thread in MYSQL_BIN_LOG::purge_index_entry function
#    using debug sync utility.
# 2. Do a DML on master so that IO thread calls queue_event and
#    updates rli->relay_log_space_total.
# 3. Verify that IO thread is waiting rli->log_space_lock until it is released
#    by SQL thread.
#
# === References ===
#
# Bug#26997096 RELAY_LOG_SPACE IS INACCURATE AND LEAKS

# This test case is binlog_format agnostic
--source include/have_binlog_format_row.inc
# This test case uses debug_sync
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/master-slave.inc

CREATE TABLE t1 (i INT);

--source include/sync_slave_sql_with_master.inc
--source include/stop_slave_sql.inc
SET GLOBAL debug='+d,wait_in_purge_index_entry';

# Create a new relay log so the START SLAVE SQL_THREAD tries
# to purge the old relay logs and hits the debug point.
FLUSH LOCAL RELAY LOGS;
START SLAVE SQL_THREAD;
SET DEBUG_SYNC="now WAIT_FOR in_purge_index_entry";

# Do a DML on master so that IO thread calls queue_event and
# updates rli->relay_log_space_total.
--source include/rpl_connection_master.inc
INSERT INTO t1 VALUES (1);
--source include/rpl_connection_slave.inc

# Wait until IO thread tries to take a log_space_lock.
--let $io_thread_id = `SELECT THREAD_ID FROM performance_schema.threads WHERE NAME like '%replica_io%'`
--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
--source include/wait_condition.inc

# Since SQL thread has taken the rli->log_space_lock, IO thread should wait until
# the lock is released. Assert that IO thread is waiting for rli->log_space_lock.
--let $assert_text= IO Thread is waiting for Relay_log_info::log_space_lock.
--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"
--source include/assert.inc

SET DEBUG_SYNC="now SIGNAL go_ahead_sql";

# Cleanup
--source include/rpl_connection_master.inc
DROP TABLE t1;
--source include/sync_slave_sql_with_master.inc
SET GLOBAL debug='-d,wait_in_purge_index_entry';
SET DEBUG_SYNC="RESET";
--source include/rpl_end.inc