# # WL#3549 # # Extra tests for binlog compression # --source include/master-slave.inc --source include/have_binlog_format_row.inc # # Test 1: Make sure that SOURCE_POS_WAIT return with success # only when the full compressed transaction is applied, otherwise # returns an error # --source include/rpl_reset.inc --source include/rpl_connection_master.inc CREATE TABLE t1 (c1 INT); CREATE TABLE t2 (c1 INT); --source include/sync_slave_sql_with_master.inc # now lock the table on the slave, so that the slave applier # cannot apply the transaction LOCK TABLE t2 READ, performance_schema.threads READ; --source include/rpl_connection_master.inc BEGIN; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); COMMIT; --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) --let $binlog_pos= query_get_value(SHOW MASTER STATUS, Position, 1) --source include/rpl_connection_slave.inc # wait for the applier to block on the lock --let $wait_condition = SELECT count(*) = 1 FROM performance_schema.threads WHERE processlist_state = "Waiting for table metadata lock" AND name IN ('thread/sql/replica_sql', "thread/sql/replica_worker") --source include/wait_condition.inc # assert that SOURCE_POS_WAIT exits with error --let $res= `SELECT SOURCE_POS_WAIT("$binlog_file", $binlog_pos, 1)` --let $assert_text= SOURCE_POS_WAIT returns -1 if the timeout has been exceeded. --let $assert_cond= $res = -1 --source include/assert.inc # assert that table t2 on the slave have no values in it # we do not check t1, since it is in the same transaction # and we have not locked it. --let $t2_count= `SELECT count(*) FROM t2` --let $assert_text= Table t2 on the slave has no records --let $assert_cond= $t2_count = 0 --source include/assert.inc # unlock and assert that now tables have the same values UNLOCK TABLE; --let $res= `SELECT SOURCE_POS_WAIT("$binlog_file", $binlog_pos, 5)` --let $assert_text= SOURCE_POS_WAIT succeeds. --let $assert_cond= $res <> -1 --source include/assert.inc --let $diff_tables=master:test.t1,slave:test.t1 --source include/diff_tables.inc --let $diff_tables=master:test.t2,slave:test.t2 --source include/diff_tables.inc # clean up --source include/rpl_connection_master.inc DROP TABLE t1, t2; --source include/sync_slave_sql_with_master.inc --source include/rpl_reset.inc # end Test 1 --source include/rpl_end.inc