# # WL#3549: Test incident events and binlog compression # # This test injects an incident event and makes sure that no # compression takes place. In addition to that it also makes # sure that no compression stats appear in performance schema. # --source include/have_debug.inc --source include/have_binlog_format_row.inc call mtr.add_suppression("An incident event has been written to the binary log which will stop the replicas"); --let $show_rpl_debug_info = 0 --let $saved_binlog_transaction_compression_session = `SELECT @@SESSION.binlog_transaction_compression` --let $compression_type = LZ4 --let $pfs_table = performance_schema.binary_log_transaction_compression_stats --eval SET SESSION binlog_transaction_compression = ON CREATE TABLE t1(c1 INT PRIMARY KEY, data TEXT(30000)); RESET MASTER; --eval TRUNCATE $pfs_table --let $pattern_to_match = $MYSQLTEST_VARDIR/mysqld.1/data/*binlog*.0* --source include/rpl_log_file_max_number.inc --let $max_log_file_before_incident = $log_file_max_number --let $debug_point=binlog_compression_inject_incident --source include/add_debug_point.inc INSERT INTO t1 VALUES (1, REPEAT ('a', 1000)); # Prior to Bug#35671897 the Incident would not be written until subseqent # query, this check verifies that it has already been written by reading the # fourth event and showing it's type, before any other query is executed. --echo Check that Incident has been written --let $evt= query_get_value(SHOW BINLOG EVENTS, Event_type, 4) echo $evt; --let $debug_point=binlog_compression_inject_incident --source include/remove_debug_point.inc # 1 - Format_desc event, 2 - Previous_gtids event --let $evt= query_get_value(SHOW BINLOG EVENTS, Event_type, 3) --let $assert_text = Expected event type Anonymous_Gtid --let $assert_cond = "$evt" = "Anonymous_Gtid" OR "$evt" = "Gtid" --source include/assert.inc --let $evt= query_get_value(SHOW BINLOG EVENTS, Event_type, 4) --let $assert_text = Expected event type Incident --let $assert_cond = "$evt" = "Incident" --source include/assert.inc # assert that we have no stats on the performance_schema table for compression --let $nrows = `SELECT COUNT(*) FROM $pfs_table WHERE log_type ='BINARY' AND compression_type='$compression_type'` --let $assert_cond = $nrows = 0 --let $assert_text = Number of rows in $pfs_table = 0 for compression_type != NONE (because of incident event) --source include/assert.inc # assert that we have the stats on the table --let $nrows = `SELECT COUNT(*) FROM $pfs_table WHERE log_type ='BINARY' AND compression_type='NONE'` --let $assert_cond = $nrows = 1 --let $assert_text = Number of rows in $pfs_table = 1 for compression_type = NONE --source include/assert.inc # assert the log file number increased, this shows that binlog was rotated --source include/rpl_log_file_max_number.inc --let $max_log_file_after_incident = $log_file_max_number --let $assert_text = incident rotated binlog --let $assert_cond = $max_log_file_before_incident + 1 = $max_log_file_after_incident --source include/assert.inc # clean up DROP TABLE t1; --replace_result $saved_binlog_transaction_compression_session SAVED --eval SET SESSION binlog_transaction_compression = $saved_binlog_transaction_compression_session RESET MASTER; --eval TRUNCATE $pfs_table