Debian Codegraph @

mysql-test/suite/rpl_gtid/t/rpl_sql_delay.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 --let $rpl_skip_start_slave= 1
19 --source include/master-slave.inc
20
21 --let $delay= 7
22 --let $slave_sleep= 2
23
24 --source include/rpl_connection_slave.inc
25 --eval CHANGE REPLICATION SOURCE TO SOURCE_DELAY= $delay
26 source include/start_slave.inc;
27
28 # Verify that the DESIRED_DELAY in replication_applier_configuration table
29 # of performance_schema and SQL_Delay field of show slave status has the
30 # same value as the delay set through the master_delay of the CHM command.
31
32 --let $desired_delay= query_get_value(select *from performance_schema.replication_applier_configuration,DESIRED_DELAY,1)
33
34 --let $assert_text= Assert that the desired delay from performance_schema is same as set in the Change master to command.
35 --let $assert_cond= $desired_delay = $delay
36 --source include/assert.inc
37
38 --let $sql_delay= query_get_value(show slave status,SQL_Delay,1)
39
40 --let $assert_text= Assert that the sql_delay in show slave status is same as set in the Change master to command.
41 --let $assert_cond= $sql_delay = $delay
42 --source include/assert.inc
43
44 --source include/rpl_connection_master.inc
45 CREATE TABLE t1 (a INT);
46 --let $trx_num= 1
47 --source extra/rpl_tests/check_slave_delay.inc
48
49 INSERT INTO t1 VALUES (1);
50 --let $trx_num= 2
51 --source extra/rpl_tests/check_slave_delay.inc
52
53 UPDATE t1 SET a=2;
54 --let $trx_num= 3
55 --source extra/rpl_tests/check_slave_delay.inc
56
57 DELETE FROM t1 WHERE a=2;
58 --let $trx_num= 4
59 --source extra/rpl_tests/check_slave_delay.inc
60
61 START TRANSACTION;
62 INSERT INTO t1 VALUES (1);
63 INSERT INTO t1 VALUES (2);
64 INSERT INTO t1 VALUES (3);
65 COMMIT;
66 --let $trx_num= 5
67 --source extra/rpl_tests/check_slave_delay.inc
68
69 DROP TABLE t1;
70 --let $trx_num= 6
71 --source extra/rpl_tests/check_slave_delay.inc
72
73 # Cleanup
74 --source include/rpl_connection_slave.inc
75 --source include/stop_slave_sql.inc
76 CHANGE REPLICATION SOURCE TO SOURCE_DELAY= 0;
77 --source include/start_slave_sql.inc
78
79 --source include/rpl_connection_master.inc
80 --source include/rpl_end.inc