| 1 |
# This test should run specifically on linux, given the toolchain |
| 2 |
# it needs to be able to execute properly |
| 3 |
# Also, Disable windows run due to Bug#29435008 |
| 4 |
--source include/linux.inc |
| 5 |
|
| 6 |
# no need to run the tests in this file more than one combination |
| 7 |
--source include/have_binlog_format_row.inc |
| 8 |
|
| 9 |
# this test checks compression, so needs binlog not compressed |
| 10 |
--source include/not_binlog_transaction_compression_on.inc |
| 11 |
|
| 12 |
# |
| 13 |
# WL#2726 |
| 14 |
# |
| 15 |
# This test checks that the binlog output using the compressed |
| 16 |
# protocol transfer mode is the same as the one using the |
| 17 |
# non-compressed protocol transfer |
| 18 |
# |
| 19 |
# This test also checks that the binlog data transferred over |
| 20 |
# network is less when executing mysqlbinlog with compression |
| 21 |
# option compared to executing mysqlbinlog without compression |
| 22 |
# |
| 23 |
|
| 24 |
# no need to log result or query logs |
| 25 |
--disable_query_log |
| 26 |
--disable_result_log |
| 27 |
|
| 28 |
RESET MASTER; |
| 29 |
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 30 |
|
| 31 |
# generate some binlog entries |
| 32 |
CREATE TABLE t1 (c1 INT); |
| 33 |
--let $iterations=10 |
| 34 |
while($iterations) |
| 35 |
{ |
| 36 |
--eval INSERT INTO t1 VALUES ($iterations) |
| 37 |
--dec $iterations |
| 38 |
} |
| 39 |
DROP TABLE t1; |
| 40 |
|
| 41 |
--let $not_compressed_result_file = $MYSQL_TMP_DIR/binlog-no-compress.000001 |
| 42 |
--let $compressed_result_file = $MYSQL_TMP_DIR/binlog-compress.000001 |
| 43 |
|
| 44 |
--let $mysqlbinlog_parameters = --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $binlog_file > $not_compressed_result_file |
| 45 |
--source include/mysqlbinlog.inc |
| 46 |
|
| 47 |
--let $mysqlbinlog_parameters = --compress --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $binlog_file > $compressed_result_file |
| 48 |
--source include/mysqlbinlog.inc |
| 49 |
|
| 50 |
--let NOT_COMPRESSED=not_compressed_result_file |
| 51 |
--let COMPRESSED=$compressed_result_file |
| 52 |
|
| 53 |
--perl |
| 54 |
use File::Compare; |
| 55 |
my $uncompressed=$ENV{'NOT_COMPRESSED'} or die ("Uncompressed result file name not set!"); |
| 56 |
my $compressed=$ENV{'COMPRESSED'} or die ("Compressed result file name not set!"); |
| 57 |
die ("Comparison between the output of mysqlbinlog parsing of binary logs transferred with and without compression differs!") if compare($uncompressed, $compressed) == 0; |
| 58 |
EOF |
| 59 |
|
| 60 |
--remove_file $not_compressed_result_file |
| 61 |
--remove_file $compressed_result_file |
| 62 |
|
| 63 |
# RESET MASTER for the next test to start clean |
| 64 |
RESET MASTER; |
| 65 |
# Check compression achieved using compress option |
| 66 |
# Generate a large transaction that is over 1MB |
| 67 |
CREATE TABLE t (a LONGTEXT); |
| 68 |
INSERT INTO t VALUES (REPEAT('a', 1000000)); |
| 69 |
DROP TABLE t; |
| 70 |
|
| 71 |
# Get the initial number of bytes written to the socket |
| 72 |
--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'` |
| 73 |
# Execute mysqlbinlog with compression |
| 74 |
--let $mysqlbinlog_parameters = --compress --read-from-remote-server --user=root --socket=$MASTER_MYSOCK $binlog_file |
| 75 |
--source include/mysqlbinlog.inc |
| 76 |
# Get the byte count through socket after executing mysqlbinlog with compression |
| 77 |
--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'` |
| 78 |
|
| 79 |
# Execute mysqlbinlog without compression |
| 80 |
--let $mysqlbinlog_parameters = --read-from-remote-server --user=root --socket=$MASTER_MYSOCK $binlog_file |
| 81 |
--source include/mysqlbinlog.inc |
| 82 |
# Get the byte count through socket after executing mysqlbinlog without compression |
| 83 |
--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'` |
| 84 |
|
| 85 |
# The transaction when compressed will be just in the order of Kilo Bytes |
| 86 |
# Hence assert that $after_no_compression-$before is much bigger than $after_compression-$before |
| 87 |
--let $assert_text= Assert that bytes written to socket are less with compression |
| 88 |
--let $assert_cond= $after_no_compression-$before > 100 * ($after_compression-$before) |
| 89 |
--source include/assert.inc |
| 90 |
|
| 91 |
# clean up the binlog |
| 92 |
RESET MASTER; |
| 93 |
|
| 94 |
# enabling result and query log back |
| 95 |
--enable_result_log |
| 96 |
--enable_query_log |