# # 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