Debian Codegraph @

mysql-test/suite/rpl/t/rpl_sql_delay_old.test

raw
1 #
2 # ==== Purpose ====
3 #
4 # This test checks if the sql delay is being applied in a simple master-slave
5 # topology.
6 #
7 # ==== Implementation ====
8 #
9 # The SQL_Delay is set to 5 seconds.
10 # For each for the six different transactions executed (two DDL, three DML and
11 # one multi-statement DML), the test verifies if the delay was the expected using
12 # replication timestamp infrastructure introduced by WL#7319.
13 #
14 # ==== References ====
15 #
16 # WL#7318 Delayed Replication: GTID based and relative to immediate master commit
17
18 # This test is very unstable when using windows because support for high
19 # precision timestamps in this platform is not as good as in unix
20 --source include/not_windows.inc
21 --source include/have_debug.inc
22
23 --let $rpl_skip_start_slave= 1
24 --source include/master-slave.inc
25
26 --let $delay= 7
27 --let $slave_sleep= 2
28
29 --source include/rpl_connection_slave.inc
30 --eval CHANGE REPLICATION SOURCE TO SOURCE_DELAY= $delay
31 source include/start_slave.inc;
32
33 # Verify that the DESIRED_DELAY in replication_applier_configuration table
34 # of performance_schema and SQL_Delay field of show slave status has the
35 # same value as the delay set through the master_delay of the CHM command.
36
37 --let $desired_delay= query_get_value(select *from performance_schema.replication_applier_configuration,DESIRED_DELAY,1)
38
39 --let $assert_text= Assert that the desired delay from performance_schema is same as set in the Change master to command.
40 --let $assert_cond= $desired_delay = $delay
41 --source include/assert.inc
42
43 --let $sql_delay= query_get_value(show slave status,SQL_Delay,1)
44
45 --let $assert_text= Assert that the sql_delay in show slave status is same as set in the Change master to command.
46 --let $assert_cond= $sql_delay = $delay
47 --source include/assert.inc
48
49 --let $debug_point= sql_delay_without_timestamps
50 --source include/add_debug_point.inc
51
52 --source include/rpl_connection_master.inc
53 # $time_1 is collected in the same server as $time_2
54 # Since the delay is relative to the master's clock, we collect the time in
55 # master
56 --let $time_1= `SELECT SYSDATE(6)`
57 CREATE TABLE t1 (a INT);
58 --source extra/rpl_tests/check_slave_delay_old.inc
59
60 INSERT INTO t1 VALUES (1);
61 --source extra/rpl_tests/check_slave_delay_old.inc
62
63 UPDATE t1 SET a=2;
64 --source extra/rpl_tests/check_slave_delay_old.inc
65
66 DELETE FROM t1 WHERE a=2;
67 --source extra/rpl_tests/check_slave_delay_old.inc
68
69 START TRANSACTION;
70 INSERT INTO t1 VALUES (1);
71 INSERT INTO t1 VALUES (2);
72 INSERT INTO t1 VALUES (3);
73 COMMIT;
74 --source extra/rpl_tests/check_slave_delay_old.inc
75
76 DROP TABLE t1;
77 --source extra/rpl_tests/check_slave_delay_old.inc
78
79 # Cleanup
80 --source include/rpl_connection_slave.inc
81 --source include/remove_debug_point.inc
82 --source include/stop_slave_sql.inc
83 CHANGE REPLICATION SOURCE TO SOURCE_DELAY= 0;
84 --source include/start_slave_sql.inc
85
86 --source include/rpl_connection_master.inc
87 --source include/rpl_end.inc