File: check_slave_delay.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 (62 lines) | stat: -rw-r--r-- 2,825 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
### Purpose ###
#
# This test file is invoked from rpl_sql_delay.
#
# 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 verify that the slave's only starts applying the transaction after
# the delay is observed, through its immediate_commit_timestamp.
#
#
### 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
# $trx_num      the gno of the transaction's gtid


--source include/rpl_connection_slave.inc

--sleep $slave_sleep

--let $remaining_delay= query_get_value(SELECT REMAINING_DELAY 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

--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
--let $server_uuid= query_get_value(SELECT @@global.server_uuid, @@global.server_uuid, 1)
--let $gtid= $server_uuid:$trx_num
--source include/get_immediate_commit_timestamp.inc
--let $master_immediate_commit_timestamp= $immediate_commit_timestamp

--source include/rpl_connection_slave.inc
--let $gtid= $server_uuid:$trx_num
--source include/get_immediate_commit_timestamp.inc
--let $slave_immediate_commit_timestamp= $immediate_commit_timestamp
--let $sql_delay= query_get_value("SHOW SLAVE STATUS", SQL_Delay, 1)
# Ceiling is also used when computing the delay in the code
--let $timestamp_diff_ms= `SELECT $slave_immediate_commit_timestamp-$master_immediate_commit_timestamp`
--let $timestamp_diff_sec= `SELECT CEILING($timestamp_diff_ms / 1000000)`

--let $assert_text= The difference between the immediate_commit_timestamp should be at least the SQL_Delay
--let $assert_cond= $timestamp_diff_sec >= $sql_delay
--source include/assert.inc

--source include/rpl_connection_master.inc