Debian Codegraph @

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

raw
1 #
2 # This file contains test cases that test a combination of binlog
3 # transaction compression and semi-sync
4 #
5
6 #
7 # ==== Purpose ====
8 #
9 # The following test verifies that when a large transaction is issued
10 # it gets compressed and replicated to the slave using semi-sync replication.
11 #
12 # ==== Implementation ====
13 #
14 # The test does:
15 # 1. generate a DDL and verifies that it is replicated properly.
16 # 2. generate a large DML and verifies that it is replicated properly.
17 # 3. drop the table
18 # 4. Validates that the following stats are as expected:
19 # Rpl_semi_sync_source_yes_tx
20 # Rpl_semi_sync_source_clients
21 # Rpl_semi_sync_source_status
22 # Rpl_semi_sync_replica_status
23 # 5. Clean up
24 #
25 # ==== References ====
26 #
27 # WL#3549: binlog compression
28 #
29 --source include/master-slave.inc
30 --source include/have_binlog_format_row.inc
31
32 #
33 # Setup
34 #
35 --source include/rpl_connection_master.inc
36 CALL mtr.add_suppression("Semi-sync source failed on net_flush.*");
37 --source include/install_semisync_source.inc
38
39 --source include/rpl_connection_slave.inc
40 CALL mtr.add_suppression("Semi-sync replica net_flush.*");
41 --source include/install_semisync_replica.inc
42
43 #
44 # 1. Run a sanity test
45 #
46
47 --source include/rpl_connection_slave.inc
48 --source include/stop_slave.inc
49 --source include/start_slave.inc
50 --source include/rpl_connection_master.inc
51
52 SET SESSION binlog_transaction_compression=ON;
53
54 # DDL
55 --source include/rpl_connection_master.inc
56 CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY, c2 LONGTEXT);
57 --source include/sync_slave_sql_with_master.inc
58
59 # DML
60 --source include/rpl_connection_master.inc
61 BEGIN;
62 --let $nrows = 10
63 while ($nrows > 0)
64 {
65 --eval INSERT INTO t1 VALUES ($nrows, REPEAT('a', 1000000))
66 --dec $nrows
67 }
68 COMMIT;
69 --let $checksum_master = query_get_value(CHECKSUM TABLE t1 EXTENDED, Checksum, 1)
70
71 --source include/sync_slave_sql_with_master.inc
72 --let $checksum_slave = query_get_value(CHECKSUM TABLE t1 EXTENDED, Checksum, 1)
73
74 --let $assert_cond= $checksum_master = $checksum_slave
75 --let $assert_text= Assert that master and slave tables have the same content
76 --source include/assert.inc
77
78 # DDL
79 --source include/rpl_connection_master.inc
80 DROP TABLE t1;
81 --source include/sync_slave_sql_with_master.inc
82
83 --let $i = 4
84 while ($i > 0)
85 {
86 if ($i == 1)
87 {
88 --source include/rpl_connection_master.inc
89 --let $actual=`SELECT variable_value FROM performance_schema.global_status WHERE variable_name = 'Rpl_semi_sync_source_yes_tx'`
90 # The 1 DML and 2 DDL transactions
91 --let $expected=3
92 --let $assert_text= Assert that the expected number of commits were acknowledged
93 }
94
95 if ($i == 2)
96 {
97 --source include/rpl_connection_master.inc
98 --let $actual=`SELECT variable_value FROM performance_schema.global_status WHERE variable_name = 'Rpl_semi_sync_source_clients'`
99 --let $expected=1
100 --let $assert_text= Assert that the slave is still there
101 }
102
103 if ($i == 3)
104 {
105 --source include/rpl_connection_master.inc
106 --let $actual=`SELECT variable_value = "ON" FROM performance_schema.global_status WHERE variable_name = 'Rpl_semi_sync_source_status'`
107 --let $expected=1
108 --let $assert_text= Assert that semisync is still up and running on the master
109 }
110
111 if ($i == 4)
112 {
113 --source include/rpl_connection_slave.inc
114 --let $actual=`SELECT variable_value = "ON" FROM performance_schema.global_status WHERE variable_name = 'Rpl_semi_sync_replica_status'`
115 --let $expected=1
116 --let $assert_text= Assert that semisync is still up and running on the slave
117 }
118
119 --let $assert_cond= $actual = $expected
120 --source include/assert.inc
121 --dec $i
122 }
123
124 #
125 # Clean up
126 #
127 --source include/rpl_connection_slave.inc
128 --source include/stop_slave.inc
129 --source include/uninstall_semisync_replica.inc
130 --source include/start_slave.inc
131
132 --source include/rpl_connection_master.inc
133 --source include/uninstall_semisync_source.inc
134
135 --source include/rpl_end.inc