-
Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathcheck_replica_delay_multi_source.inc
47 lines (39 loc) · 1.85 KB
/
check_replica_delay_multi_source.inc
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
### Purpose ###
#
# This test file is invoked from rpl_sql_delay_multi_source.
#
# 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 ###
#
# $trx_num the gno of the transaction's gtid
# $slave slaves connection
# $master masters connection
--let $sync_slave_connection= $slave
--source include/rpl/sync_to_replica.inc
--let $assert_text= Status should not be 'Waiting until SOURCE_DELAY seconds after source executed event'
--let $assert_cond= NOT("[SHOW REPLICA STATUS, Replica_SQL_Running_State, 1]" LIKE "Waiting until % seconds after source executed event")
--source include/assert.inc
--let $rpl_connection_name= $master
--source include/connection.inc
--let $server_uuid= query_get_value(SELECT @@global.server_uuid, @@global.server_uuid, 1)
--let $gtid= $server_uuid:$trx_num
--source include/rpl/get_immediate_commit_timestamp.inc
--let $master_immediate_commit_timestamp= `SELECT $immediate_commit_timestamp`
--let $rpl_connection_name= $slave
--source include/connection.inc
--let $gtid= $server_uuid:$trx_num
--source include/rpl/get_immediate_commit_timestamp.inc
--let $slave_immediate_commit_timestamp= `SELECT $immediate_commit_timestamp`
--let $sql_delay= query_get_value("SHOW REPLICA STATUS", SQL_Delay, 1)
#ceiling is also used when computing the delay in the code
--let $timestamp_diff= `SELECT CEILING(($slave_immediate_commit_timestamp-$master_immediate_commit_timestamp)/1000000)`
--let $assert_text= The difference between the immediate_commit_timestamp should be at least the SQL_Delay
--let $assert_cond= $timestamp_diff >= $sql_delay
--source include/assert.inc
--let $rpl_connection_name= $master
--source include/connection.inc