File: rpl_sbm_fake_rotate_event.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 (61 lines) | stat: -rw-r--r-- 2,465 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
###############################################################################
# Bug#23532304 SECONDS_BEHIND_MASTER REPORTS IO_THREAD TIME WHEN USING MTS &
#              ROTATING RELAY-LOG
# Problem: The value of 'Seconds_Behind_Master' (SBM) reports distorted number
#         when rotating a relay-log.
#
# Steps to reproduce:
#  1) Fake that I/O thread is started 3 minutes ago using a debug point.
#  2) Flush the logs on the master which would have generated fake rotate
#  event
#  3) While the fake rotate event is getting executing, calculate the SBM
#  4) Compare the executed SBM that it is not greater than or equal to I/O
#     thread's active time.
#  5) Clean the debug point.
#
###############################################################################
--source include/have_debug_sync.inc
--let rpl_skip_start_slave=1
--source include/master-slave.inc

# Step-1 Set sync debug point to calculate sbm exactly after fake
#  rotate log event.
--source include/rpl_connection_slave.inc
SET @save_global_debug=@@GLOBAL.DEBUG;
# This debug point internally fake that IO thread is started 3 minutes ago.
SET @@GLOBAL.DEBUG= '+d,dbug.calculate_sbm_after_fake_rotate_log_event';
# Start slave threads after enabling the debug point.
--disable_warnings
--source include/start_slave.inc
--enable_warnings

# Step-2 Flush logs on master which will generate a fake rotate event.
--source include/rpl_connection_master.inc
FLUSH LOGS;

# Step-3 There will be two fake rotate events (first one while the initial setup
# in master-slave.inc and second one due to FLUSH LOGS execution on master).
# The following will test SBM calculation while both events are getting
# executed.
--source include/rpl_connection_slave.inc
--let $iter=0
while ($iter < 2)
{
# Step-4: Calcualte SBM while fake rotate log event is getting executed.
# It should be approximately zero (some times little more than zero
# if this test is run on a slow pb2 machine). Comparing with the
# I/O thread age that it should be atleast less
# than the age of I/O thread.
SET DEBUG_SYNC="now wait_for signal.reached";
let $sbm= query_get_value("SHOW SLAVE STATUS", Seconds_Behind_Master, 1);
--let $assert_text= Seconds Behind Master should be less than IO_THREAD's time.
--let $assert_cond= $sbm < 180
--source include/assert.inc
SET DEBUG_SYNC="now signal signal.done_sbm_calculation";
--inc $iter
}

# Step-5: Cleanup
SET @@GLOBAL.DEBUG=@save_global_debug;

--source include/rpl_end.inc