File: binlog_compression_semisync.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (135 lines) | stat: -rw-r--r-- 3,874 bytes parent folder | download
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#
# This file contains test cases that test a combination of binlog
# transaction compression and semi-sync
#

#
# ==== Purpose ====
#
# The following test verifies that when a large transaction is issued
# it gets compressed and replicated to the slave using semi-sync replication.
#
# ==== Implementation ====
#
# The test does:
# 1. generate a DDL and verifies that it is replicated properly.
# 2. generate a large DML and verifies that it is replicated properly.
# 3. drop the table
# 4. Validates that the following stats are as expected:
#    Rpl_semi_sync_source_yes_tx
#    Rpl_semi_sync_source_clients
#    Rpl_semi_sync_source_status
#    Rpl_semi_sync_replica_status
# 5. Clean up
#
# ==== References ====
#
# WL#3549: binlog compression
#
--source include/master-slave.inc
--source include/have_binlog_format_row.inc

#
# Setup
#
--source include/rpl_connection_master.inc
CALL mtr.add_suppression("Semi-sync source failed on net_flush.*");
--source include/install_semisync_source.inc

--source include/rpl_connection_slave.inc
CALL mtr.add_suppression("Semi-sync replica net_flush.*");
--source include/install_semisync_replica.inc

#
# 1. Run a sanity test
#

--source include/rpl_connection_slave.inc
--source include/stop_slave.inc
--source include/start_slave.inc
--source include/rpl_connection_master.inc

SET SESSION binlog_transaction_compression=ON;

# DDL
--source include/rpl_connection_master.inc
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY, c2 LONGTEXT);
--source include/sync_slave_sql_with_master.inc

# DML
--source include/rpl_connection_master.inc
BEGIN;
--let $nrows = 10
while ($nrows > 0)
{
  --eval INSERT INTO t1 VALUES ($nrows, REPEAT('a', 1000000))
  --dec $nrows
}
COMMIT;
--let $checksum_master = query_get_value(CHECKSUM TABLE t1 EXTENDED, Checksum, 1)

--source include/sync_slave_sql_with_master.inc
--let $checksum_slave = query_get_value(CHECKSUM TABLE t1 EXTENDED, Checksum, 1)

--let $assert_cond= $checksum_master = $checksum_slave
--let $assert_text= Assert that master and slave tables have the same content
--source include/assert.inc

# DDL
--source include/rpl_connection_master.inc
DROP TABLE t1;
--source include/sync_slave_sql_with_master.inc

--let $i = 4
while ($i > 0)
{
  if ($i == 1)
  {
    --source include/rpl_connection_master.inc
    --let $actual=`SELECT variable_value FROM performance_schema.global_status WHERE variable_name = 'Rpl_semi_sync_source_yes_tx'`
    # The 1 DML and 2 DDL transactions
    --let $expected=3
    --let $assert_text= Assert that the expected number of commits were acknowledged
  }

  if ($i == 2)
  {
    --source include/rpl_connection_master.inc
    --let $actual=`SELECT variable_value FROM performance_schema.global_status WHERE variable_name = 'Rpl_semi_sync_source_clients'`
    --let $expected=1
    --let $assert_text= Assert that the slave is still there
  }

  if ($i == 3)
  {
    --source include/rpl_connection_master.inc
    --let $actual=`SELECT variable_value = "ON" FROM performance_schema.global_status WHERE variable_name = 'Rpl_semi_sync_source_status'`
    --let $expected=1
    --let $assert_text= Assert that semisync is still up and running on the master
  }

  if ($i == 4)
  {
    --source include/rpl_connection_slave.inc
    --let $actual=`SELECT variable_value = "ON" FROM performance_schema.global_status WHERE variable_name = 'Rpl_semi_sync_replica_status'`
    --let $expected=1
    --let $assert_text= Assert that semisync is still up and running on the slave
  }

  --let $assert_cond= $actual = $expected
  --source include/assert.inc
  --dec $i
}

#
# Clean up
#
--source include/rpl_connection_slave.inc
--source include/stop_slave.inc
--source include/uninstall_semisync_replica.inc
--source include/start_slave.inc

--source include/rpl_connection_master.inc
--source include/uninstall_semisync_source.inc

--source include/rpl_end.inc