File: check_slave_delay_old.inc

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-- 2,268 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
### Purpose ###
#
# This test file is invoked from rpl_sql_delay_old.
#
# After sleeping for $slave_sleep seconds (less that $delay), we check that the
# slave is still waiting for MASTER_DELAY.
# After synchronizing with the master, we check that the slave is no longer
# waiting for the delay.
# Then, we check that the delay was applied.
#
#
### Parameters ###
#
# $slave_sleep  number of seconds the slave sleeps before checking if it is
#               still waiting for the delay
# $delay        number of seconds configured for slave delay


--source include/rpl_connection_slave.inc

--sleep $slave_sleep

--let $remaining_delay=query_get_value(Select *from performance_schema.replication_applier_status,REMAINING_DELAY,1)
--let $sql_remaining_delay=query_get_value(show slave status,SQL_Remaining_Delay,1)

# Assert that the remaining delay value shown by both show slave status
# and replication_applier_status table of performance schema is same.
# using '>=' since $remaining_delay is obtained before $sql_remaining_delay.

--let $assert_text= Assert that the REMAINING_DELAY from performance_schema is same as SQL_Remaining_Delay in the output of show slave status.
--let $assert_cond= "$remaining_delay" >= "$sql_remaining_delay"
--source include/assert.inc

--source include/rpl_connection_master.inc
--source include/sync_slave_sql_with_master.inc

--source include/rpl_connection_master.inc
--let $time_2= `SELECT SYSDATE(6)`

--source include/rpl_connection_slave.inc
--let $ms_diff= `SELECT TIMESTAMPDIFF(MICROSECOND,'$time_1','$time_2')`
# Ceiling is also used when computing the delay in the code
--let $time_diff= `SELECT CEILING($ms_diff / 1000000)`
--let $assert_text= In the old infrastructure, the execution time of the transaction in the slave must be at least the delay
--let $assert_cond= $time_diff >= $delay
--source include/assert.inc

--let $assert_text= Status should not be 'Waiting until SOURCE_DELAY seconds after source executed event'
--let $assert_cond= NOT("[SHOW SLAVE STATUS, Slave_SQL_Running_State, 1]" LIKE "Waiting until % seconds after source executed event")
--source include/assert.inc

--source include/rpl_connection_master.inc
# $time_1 is collected in the same server as $time_2
--let $time_1= `SELECT SYSDATE(6)`