-
Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathcheck_replica_delay_multiple.inc
58 lines (46 loc) · 2.25 KB
/
check_replica_delay_multiple.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
48
49
50
51
52
53
54
55
56
57
58
### Purpose ###
#
# This test file is invoked from rpl_sql_delay_multiple.
#
# After synchronizing both slaves 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
--let $sync_slave_connection= server_2
--source include/rpl/sync_to_replica.inc
--let $rpl_connection_name= server_1
--source include/connection.inc
--let $sync_slave_connection= server_3
--source include/rpl/sync_to_replica.inc
--let $rpl_connection_name= server_1
--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= server_2
--source include/connection.inc
--source include/rpl/get_immediate_commit_timestamp.inc
--let $slave1_immediate_commit_timestamp= `SELECT $immediate_commit_timestamp`
--let $sql_delay_1= query_get_value("SHOW REPLICA STATUS", SQL_Delay, 1)
#ceiling is also used when computing the delay in the code
--let $timestamp_1_diff= `SELECT CEILING(($slave1_immediate_commit_timestamp-$master_immediate_commit_timestamp)/ 1000000)`
--let $rpl_connection_name= server_3
--source include/connection.inc
--source include/rpl/get_immediate_commit_timestamp.inc
--let $slave2_immediate_commit_timestamp= `SELECT $immediate_commit_timestamp`
--let $sql_delay_2= query_get_value("SHOW REPLICA STATUS", SQL_Delay, 1)
#ceiling is also used when computing the delay in the code
--let $timestamp_2_diff= `SELECT CEILING(($slave2_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_1_diff >= $sql_delay_1
--source include/assert.inc
--let $assert_text= The difference between the immediate_commit_timestamp should be at least the SQL_Delay
--let $assert_cond= $timestamp_2_diff >= $sql_delay_2
--source include/assert.inc
--let $rpl_connection_name=server_1
--source include/connection.inc