File: binlog_mysqlbinlog_linux.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 (96 lines) | stat: -rw-r--r-- 4,031 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
# This test should run specifically on linux, given the toolchain
# it needs to be able to execute properly
# Also, Disable windows run due to Bug#29435008
--source include/linux.inc

# no need to run the tests in this file more than one combination
--source include/have_binlog_format_row.inc

# this test checks compression, so needs binlog not compressed
--source include/not_binlog_transaction_compression_on.inc

#
# WL#2726
#
# This test checks that the binlog output using the compressed
# protocol transfer mode is the same as the one using the
# non-compressed protocol transfer
#
# This test also checks that the binlog data transferred over
# network is less when executing mysqlbinlog with compression
# option compared to executing mysqlbinlog without compression
#

# no need to log result or query logs
--disable_query_log
--disable_result_log

RESET MASTER;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)

# generate some binlog entries
CREATE TABLE t1 (c1 INT);
--let $iterations=10
while($iterations)
{
  --eval INSERT INTO t1 VALUES ($iterations)
  --dec $iterations
}
DROP TABLE t1;

--let $not_compressed_result_file = $MYSQL_TMP_DIR/binlog-no-compress.000001
--let $compressed_result_file = $MYSQL_TMP_DIR/binlog-compress.000001

--let $mysqlbinlog_parameters = --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $binlog_file > $not_compressed_result_file
--source include/mysqlbinlog.inc

--let $mysqlbinlog_parameters = --compress --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $binlog_file > $compressed_result_file
--source include/mysqlbinlog.inc

--let NOT_COMPRESSED=not_compressed_result_file
--let COMPRESSED=$compressed_result_file

--perl
use File::Compare;
my $uncompressed=$ENV{'NOT_COMPRESSED'} or die ("Uncompressed result file name not set!");
my $compressed=$ENV{'COMPRESSED'} or die ("Compressed result file name not set!");
die ("Comparison between the output of mysqlbinlog parsing of binary logs transferred with and without compression differs!") if compare($uncompressed, $compressed) == 0;
EOF

--remove_file $not_compressed_result_file
--remove_file $compressed_result_file

# RESET MASTER for the next test to start clean
RESET MASTER;
# Check compression achieved using compress option
# Generate a large transaction that is over 1MB
CREATE TABLE t (a LONGTEXT);
INSERT INTO t VALUES (REPEAT('a', 1000000));
DROP TABLE t;

# Get the initial number of bytes written to the socket
--let $before= `SELECT SUM_NUMBER_OF_BYTES_WRITE FROM performance_schema.socket_summary_by_event_name WHERE EVENT_NAME = 'wait/io/socket/sql/client_connection'`
# Execute mysqlbinlog with compression
--let $mysqlbinlog_parameters = --compress --read-from-remote-server --user=root --socket=$MASTER_MYSOCK $binlog_file
--source include/mysqlbinlog.inc
# Get the byte count through socket after executing mysqlbinlog with compression
--let $after_compression= `SELECT SUM_NUMBER_OF_BYTES_WRITE FROM performance_schema.socket_summary_by_event_name WHERE EVENT_NAME = 'wait/io/socket/sql/client_connection'`

# Execute mysqlbinlog without compression
--let $mysqlbinlog_parameters = --read-from-remote-server --user=root --socket=$MASTER_MYSOCK $binlog_file
--source include/mysqlbinlog.inc
# Get the byte count through socket after executing mysqlbinlog without compression
--let $after_no_compression= `SELECT SUM_NUMBER_OF_BYTES_WRITE FROM performance_schema.socket_summary_by_event_name WHERE EVENT_NAME = 'wait/io/socket/sql/client_connection'`

# The transaction when compressed will be just in the order of Kilo Bytes
# Hence assert that $after_no_compression-$before is much bigger than $after_compression-$before
--let $assert_text= Assert that bytes written to socket are less with compression
--let $assert_cond= $after_no_compression-$before > 100 * ($after_compression-$before)
--source include/assert.inc

# clean up the binlog
RESET MASTER;

# enabling result and query log back
--enable_result_log
--enable_query_log