| 1 |
# |
| 2 |
# WL#3549: binlog compression |
| 3 |
# |
| 4 |
# This test file contains tests for performance_schema.binary_log_transaction_compression_stats |
| 5 |
# that require a server restart |
| 6 |
# |
| 7 |
# |
| 8 |
--source include/have_binlog_format_row.inc |
| 9 |
|
| 10 |
# slow test |
| 11 |
--source include/not_valgrind.inc |
| 12 |
|
| 13 |
# setup |
| 14 |
--let $saved_binlog_transaction_compression_session_master = `SELECT @@SESSION.binlog_transaction_compression` |
| 15 |
--let $saved_binlog_transaction_compression_global_master = `SELECT @@GLOBAL.binlog_transaction_compression` |
| 16 |
--let $trx_size_bytes = 1000000 |
| 17 |
--let $pfs_table = performance_schema.binary_log_transaction_compression_stats |
| 18 |
|
| 19 |
# |
| 20 |
# Test 1: Issue one transaction and then restart the server note that |
| 21 |
# the stats are gone |
| 22 |
# |
| 23 |
|
| 24 |
SET SESSION binlog_transaction_compression = ON; |
| 25 |
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY, c2 LONGTEXT); |
| 26 |
--eval INSERT INTO t1 VALUES (2, REPEAT('b', $trx_size_bytes)) |
| 27 |
DROP TABLE t1; |
| 28 |
|
| 29 |
# there are two row (DDL - compression is none, DML - compression is ZSTD) |
| 30 |
# in the table |
| 31 |
--let $nrows = `SELECT COUNT(*) FROM $pfs_table` |
| 32 |
--let $assert_cond = $nrows = 2 |
| 33 |
--let $assert_text = Number of rows in $pfs_table = 2 |
| 34 |
--source include/assert.inc |
| 35 |
|
| 36 |
# now lets restart the server |
| 37 |
--source include/restart_mysqld.inc |
| 38 |
|
| 39 |
# there are zero rows in the table |
| 40 |
--let $nrows = `SELECT COUNT(*) FROM $pfs_table` |
| 41 |
--let $assert_cond = $nrows = 0 |
| 42 |
--let $assert_text = Number of rows in $pfs_table = 0 |
| 43 |
--source include/assert.inc |
| 44 |
|
| 45 |
# |
| 46 |
# Test 2: Restart the server with the binary log disabled |
| 47 |
# |
| 48 |
|
| 49 |
--let $restart_parameters=restart:--skip-log-bin |
| 50 |
--source include/restart_mysqld.inc |
| 51 |
|
| 52 |
SET SESSION binlog_transaction_compression = ON; |
| 53 |
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY, c2 LONGTEXT); |
| 54 |
--eval INSERT INTO t1 VALUES (2, REPEAT('b', $trx_size_bytes)) |
| 55 |
DROP TABLE t1; |
| 56 |
|
| 57 |
# there are zero rows in the table |
| 58 |
--let $nrows = `SELECT COUNT(*) FROM $pfs_table` |
| 59 |
--let $assert_cond = $nrows = 0 |
| 60 |
--let $assert_text = Number of rows in $pfs_table = 0 |
| 61 |
--source include/assert.inc |
| 62 |
|
| 63 |
--let $restart_parameters= |
| 64 |
--source include/restart_mysqld.inc |
| 65 |
|
| 66 |
# clean up |
| 67 |
|
| 68 |
--eval SET SESSION binlog_transaction_compression = $saved_binlog_transaction_compression_session_master |
| 69 |
--eval SET GLOBAL binlog_transaction_compression = $saved_binlog_transaction_compression_global_master |